Sipeed MAIX-II Dock Sound

Wie ich schon im letzten Post geschrieben habe, experimentiere ich gerade mit dem Sipeed MAIX-II Dock herum. Das kleine „KI Wunderkind“ ist noch recht jung und es gibt bisher noch recht wenig Infos dazu im Netz. Daher poste ich hier von Zeit zu Zeit, meine ersten Erfahrungen mit dem Sipeed MAIX-II Dock.

Dieses mal hebe ich mal mit dem Lautsprecher/Mikrofon herumgespielt. Das eingebaute Mikrofon und der Lautsprecher (Siehe Bild) sollten ja schnell und einfach zu verwenden sein.

Sipeed MAIX-II Dock Lautsprecher

Also erst mal sehen, ob es irgendetwas im /dev/ Ordner gibt, was nach Sound aussieht.

$ls -altr /dev/snd/
 crw-rw----    1 root     root      116,  16 Jan  1  1970 pcmC0D0p
 crw-rw----    1 root     root      116,  24 Jan  1  1970 pcmC0D0c
 crw-rw----    1 root     root      116,   0 Jan  1  1970 controlC0
 drwxr-xr-x    2 root     root           100 Jan  1  1970 .
 drwxr-xr-x    7 root     root          2820 Jan  1  1970 ..

Das sieht doch schon mal nicht schlecht aus. Also die Basis ist da. Also mal sehen, ob sich irgendetwas installieren lässt. mit dem man Sound ausgeben kann.

Als Paket-Verwaltungs-System wird hier opkg (open package management) eingesetzt.

Bei opkg handelt es sich um ein leichtgewichtiges Paketverwaltungssystem, das auf ipkg basiert. Es ist in C geschrieben und ähnelt in der Bedienung dem Advanced Package Tool (APT)/dpkg. Es ist für den Einsatz auf eingebetteten Linux-Geräten gedacht und wird in dieser Eigenschaft in den Projekten OpenEmbedded und OpenWrt verwendet.

https://en.wikipedia.org/wiki/Opkg
$opkg
 usage: opkg [options…] sub-command [arguments…]
 where sub-command is one of:
 Package Manipulation:
         update                  Update list of available packages
         upgrade           Upgrade packages
         install           Install package(s)
         configure         Configure unpacked package(s)
         remove     Remove package(s)
         flag        Flag package(s)
          =hold|noprune|user|ok|installed|unpacked (one per invocation)
 Informational Commands:
         list                    List available packages
         list-installed          List installed packages
         list-upgradable         List installed and upgradable packages
         list-changed-conffiles  List user modified configuration files
         files              List files belonging to 
         search     List package providing 
         find            List packages whose name or description matches 
         info [pkg|regexp]       Display all info for 
         status [pkg|regexp]     Display all status for 
         download           Download  to current directory
         compare-versions   
                             compare versions using <= < > >= = << >>
         print-architecture      List installable package architectures
         depends [-A] [pkgname|pat]+
         whatdepends [-A] [pkgname|pat]+
         whatdependsrec [-A] [pkgname|pat]+
         whatrecommends[-A] [pkgname|pat]+
         whatsuggests[-A] [pkgname|pat]+
         whatprovides [-A] [pkgname|pat]+
         whatconflicts [-A] [pkgname|pat]+
         whatreplaces [-A] [pkgname|pat]+
 Options:
         -A                      Query all packages not just those installed
         -V[]             Set verbosity level to .
         --verbosity[=]   Verbosity levels:
                                         0 errors only
                                         1 normal messages (default)
                                         2 informative messages
                                         3 debug
                                         4 debug level 2
         -f           Use  as the opkg configuration file
         --conf 
         --cache      Use a package cache
         -d           Use  as the the root directory for
         --dest       package installation, removal, upgrading.
                                  should be a defined dest name from
                                 the configuration file, (but can also be a
                                 directory name in a pinch).
         -o 
                Use  as the root directory for
         --offline-root     offline installation of packages.
         --add-arch :        Register architecture with given priority
         --add-dest :        Register destination with given path
 Force Options:
         --force-depends         Install/remove despite failed dependencies
         --force-maintainer      Overwrite preexisting config files
         --force-reinstall       Reinstall package(s)
         --force-overwrite       Overwrite files from other package(s)
         --force-downgrade       Allow opkg to downgrade packages
         --force-space           Disable free space checks
         --force-postinstall     Run postinstall scripts even in offline mode
         --force-remove  Remove package even if prerm script fails
         --force-checksum        Don't fail on checksum mismatches
         --noaction              No action -- test only
         --download-only No action -- download only
         --nodeps                Do not follow dependencies
         --nocase                Perform case insensitive pattern matching
         --size                  Print package size when listing available packages
         --force-removal-of-dependent-packages
                                 Remove package and all dependencies
         --autoremove            Remove packages that were installed
                                 automatically to satisfy dependencies
         -t                      Specify tmp-dir.
         --tmp-dir               Specify tmp-dir.
         -l                      Specify lists-dir.
         --lists-dir             Specify lists-dir.
 regexp could be something like 'pkgname' 'file' or similar  e.g. opkg info 'libstd' or opkg search 'libop' or opkg remove 'libncur*'

Mit opkg update werden erst mal die Paketquellen auf den aktuellen Stand gebracht und dann mit opkg list mal geprüft, was das Sipeed MAIX-II Dock Sound alles so an Möglichkeiten bereitstellt.

$opkg update
 Downloading http://mirror.sipeed.com/maix_ii/base/Packages.gz.
 Updated list of available packages in /var/opkg-lists/base.
 Downloading http://mirror.sipeed.com/maix_ii/kernel/Packages.gz.
 Updated list of available packages in /var/opkg-lists/kernel.
 Downloading http://mirror.sipeed.com/maix_ii/luci/Packages.gz.
 Updated list of available packages in /var/opkg-lists/luci.
 Downloading http://mirror.sipeed.com/maix_ii/management/Packages.gz.
 Updated list of available packages in /var/opkg-lists/management.
 Downloading http://mirror.sipeed.com/maix_ii/packages/Packages.gz.
 Updated list of available packages in /var/opkg-lists/packages.
 Downloading http://mirror.sipeed.com/maix_ii/routing/Packages.gz.
 Updated list of available packages in /var/opkg-lists/routing.
 Downloading http://mirror.sipeed.com/maix_ii/targets/Packages.gz.
 Updated list of available packages in /var/opkg-lists/targets.
 Downloading http://mirror.sipeed.com/maix_ii/telephony/Packages.gz.
 Updated list of available packages in /var/opkg-lists/telephony.
 $opkg list
 MaixPy3 - 0.2.5-1 - a cross-platform package with c & py.
 alsa-lib - 1.1.4.1-1 - This is the library package for alsa, needed by some userspace programs.
  You must have enabled the ALSA support in the kernel.
 alsa-utils - 1.1.0-1 - ALSA (Advanced Linux Sound Architecture) utilities
 busybox - 1.27.2-3 - The Swiss Army Knife of embedded Linux.
  It slices, it dices, it makes Julian Fries.
 busybox-init-base-files - 167-1612350358
 busybox-init-base-files - 167-1612257817 - This package contains a busybox init base filesystem and system scripts for OpenWrt.
 ca-certificates - 20160104 - System CA certificates
 camerademo - 1.0-1 - camerademo test sensor
 curl - 7.54.1-1 - A client-side URL transfer utility
 dropbear - 2015.71-2 - A small SSH2 server/client designed for small memory environments.
 e2fsprogs - 1.42.12-1 - This package contains essential ext2 filesystem utilities which consists of
  e2fsck, mke2fs and most of the other core ext2 filesystem utilities.
 eyesee-mpp-external - 1.0-1 - eyesee-mpp-external contains some external libs which are needed by other mpp modules.
 eyesee-mpp-middleware - 1.0-1 - eyesee-mpp-middleware contain eyesee-mpp basic libraries.
 eyesee-mpp-system - 1.0-1 - eyesee-mpp-system is as eyesee-mpp low level libraries.
 fbviewer - 1 - Frame buffer viewer image
 fontconfig - 2.12.1-3 - The Fontconfig package contains a library and support programs used for
  configuring and customizing font access.
 glib2 - 2.50.1-1 - The GLib library of C routines
 glog - 0.3.5-2 - This repository contains a C++ implementation of the Google logging
  module.  Documentation for the implementation is in doc/.
 harfbuzz - 1.7.4-1 - HarfBuzz is an OpenType text shaping engine.
 hostapd-common - 2017-11-08-2 - hostapd/wpa_supplicant common support files
 i2c-tools - 3.1.2-1 - This package contains an heterogeneous set of I2C tools for Linux. These tools
  were originally part of the lm-sensors package.
 icu - 55.1-1 - International Components for Unicode
 iperf3 - 3.0.11-1 - Iperf is a modern alternative for measuring TCP and UDP bandwidth
  performance, allowing the tuning of various parameters and
  characteristics.
 jshn - 2016-02-26-5326ce1046425154ab715387949728cfb09f4083 - Library for parsing and generating JSON from shell scripts
 jsonfilter - 2014-06-19-cdc760c58077f44fc40adbbe41e1556a67c1b9a9 - OpenWrt JSON filter utility
 kernel - 4.9.118-1-c166dfd81804ce13f1769d26dc1448a4
 kmod-8189fs - 4.9.118-1 - 8189fs support (staging)
 kmod-cfg80211 - 4.9.118-1 - Kernel modules for CFG80211 support
 kmod-spi-dev - 4.9.118-1 - This package contains the user mode SPI device driver
 kmod-vin-v4l2 - 4.9.118-1 - Video input support (staging)
 libAWIspApi - 1-1 - camera VIN ISP api for allwinner
 libattr - 20150922-1 - Extended attributes support
  This package provides libattr
 libblobmsg-json - 2016-02-26-5326ce1046425154ab715387949728cfb09f4083 - blobmsg <-> json conversion library
 libbz2 - 1.0.6-2 - bzip2 is a freely available, patent free, high-quality
  data compressor. This packages provides libbz2 library.
 libc - -1
 libcairo - 1.14.6-1 - Cairo is a 2D graphics library with support for multiple output devices.
  Currently supported output targets include the X Window System (via both Xlib and XCB).
  Quartz, Win32, image buffers, PostScript, PDF, and SVG file output.
  Experimental backends include OpenGL, BeOS, OS/2, and DirectFB.
 Cairo is designed to produce consistent output on all output media while
  taking advantage of display hardware acceleration when available
  (eg. through the X Render Extension).
 libcurl - 7.54.1-1 - A client-side URL transfer library
 libdb47 - 4.7.25.4.NC-5 - Berkeley DB library (4.7).
 libexpat - 2.1.0-3 - A fast, non-validating, stream-oriented XML parsing library.
 libext2fs - 1.42.12-1 - libext2fs is a library which can access ext2, ext3 and ext4 filesystems.
 libffi - 3.0.13-1 - The libffi library provides a portable, high level programming interface to
  various calling conventions. This allows a programmer to call any function
  specified by a call interface description at run-time.
 FFI stands for Foreign Function Interface. A foreign function interface is the
  popular name for the interface that allows code written in one language to call
  code written in another language. The libffi library really only provides the
  lowest, machine dependent layer of a fully featured foreign function interface.
  A layer must exist above libffi that handles type conversions for values passed
  between the two languages.
 libfreetype - 2.5.5-2 - The FreeType project is a team of volunteers who develop free,
  portable and high-quality software solutions for digital typography.
  They specifically target embedded systems and focus on bringing small,
  efficient and ubiquitous products.
 libgcc - -1 - GCC support library
 libgdbm - 1.11-1 - GNU database manager library
  GNU dbm is a set of database routines that use extendible hashing and
  works similar to the standard UNIX dbm routines.
 libjpeg - 9a-1 - The Independent JPEG Group's JPEG runtime library
 libjson-c - 0.12-1 - This package contains a library for javascript object notation backends.
 libjson-script - 2016-02-26-5326ce1046425154ab715387949728cfb09f4083 - Minimalistic JSON based scripting engine
 liblua - 5.1.5-1 - Lua is a powerful light-weight programming language designed for extending
  applications. Lua is also frequently used as a general-purpose, stand-alone
  language. Lua is free software.
  This package contains the Lua shared libraries, needed by other programs.
 liblzma - 5.2.2-1 - liblzma library from XZ Utils
 libmaix - 0.0.1-1 - maix middleware libs
 libncurses - 5.9-3 - Terminal handling library
 libncursesw - 5.9-3 - Terminal handling library (Unicode)
 libnghttp2 - 1.24.0 - tools in nghttp2, eg: nghttp nghttpd nghttpx h2load
  details see libnghttp2
 libnl-tiny - 0.1-5 - This package contains a stripped down version of libnl
 libopenssl - 1.1.0i-1 - The OpenSSL Project is a collaborative effort to develop a robust,
  commercial-grade, full-featured, and Open Source toolkit implementing the
  Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols as well
  as a full-strength general-purpose cryptography library.
  This package contains the OpenSSL shared libraries, needed by other programs.
 libpcre - 8.38-2 - A Perl Compatible Regular Expression library
 libpixman - 0.34.0-1 - Pixman is a low-level software library for pixel manipulation
 libpng - 1.2.56-1 - A PNG format files handling library
 libpthread - -1 - POSIX thread library
 libreadline - 6.3-1 - The Readline library provides a set of functions for use by applications
  that allow users to edit command lines as they are typed in. Both Emacs
  and vi editing modes are available. The Readline library includes
  additional functions to maintain a list of previously-entered command
  lines, to recall and perhaps reedit those lines, and perform csh-like
  history expansion on previous commands.
 librt - -1 - POSIX.1b RealTime extension library
 libsqlite3 - 3120200-1 - SQLite is a small C library that implements a self-contained, embeddable,
  zero-configuration SQL database engine.
  This package contains the SQLite (v3.x) shared library, used by other
  programs.
 libstdcpp - -1 - GNU Standard C++ Library v3
 libuapi - 1-1 - unit api for allwinner
 libubox - 2016-02-26-5326ce1046425154ab715387949728cfb09f4083 - Basic utility library
 libubus - 2016-01-26-619f3a160de4f417226b69039538882787b3811c - OpenWrt RPC client library
 libuci - 2016-02-02.1-1 - C library for the Unified Configuration Interface (UCI)
 libuclient - 2016-01-28-2e0918c7e0612449024caaaa8d44fb2d7a33f5f3 - HTTP/1.1 client library
 libuuid - 2.25.2-4 - The UUID library is used to generate unique identifiers for objects
  that may be accessible beyond the local system. This library
  generates UUIDs compatible with those created by the Open Software
  Foundation (OSF) Distributed Computing Environment (DCE) utility.
 libwebp - 0.4.3-1 - webp libraries
 libxml2 - 2.9.3-1 - A library for manipulating XML and HTML resources.
 logd - 2016-03-07-fd4bb41ee7ab136d25609c2a917beea5d52b723b - OpenWrt system log implementation
 lrzsz - 0.12.20-2 - Transfer files in your login sessions.
  Very leightweight and straight forward.
  You just need a terminal client that can do
  either X, Y or Z-modem file transfers.
 micropython - 1.9.4-2 - This package contains Micro Python, a lean and fast implementation of the Python 3.4 programming language
  that is optimised to run on a microcontroller (and low power computers).
 micropython-lib - 1.9.3-1 - This package contains micropython-lib, a project to develop a non-monolothic
  standard library for Micro Python. Note that this is a work in progress and
  several libraries may be missing, incomplete or buggy.
 mtd - 21 - This package contains an utility useful to upgrade from other firmware or
  older OpenWrt releases.
 netifd - 2016-02-01-3610a24b218974bdf2d2f709a8af9e4a990c47bd - OpenWrt Network Interface Configuration Daemon
 opencv - 4.1.0 - OpenCV (Open Source Computer Vision Library) is an open source computer vision and machine learning software library. OpenCV was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in the commercial products. Being a BSD-licensed product, OpenCV makes it easy for businesses to utilize and modify the code.
 opkg - 9c97d5ecd795709c8584e972bfdf3aee3a5b846d-10 - Lightweight package management system
  opkg is the opkg Package Management System, for handling
  installation and removal of packages on a system. It can
  recursively follow dependencies and download all packages
  necessary to install a particular package.
 opkg knows how to install both .ipk and .deb packages.
 python-pip-conf - 0.1-1 - Configuration file for pip/pip3
 python3 - 3.8.5-2 - This package contains the (almost) full Python install.
  It's python3-light + all other packages.
 python3-asyncio - 3.8.5-2 - Python 3.8 asyncio module
 python3-base - 3.8.5-2 - This package contains only the interpreter and the bare minimum
  for the interpreter to start.
 python3-certifi - 2020.6.20-1 - Certifi is a carefully curated collection of Root Certificates for validating the
  trustworthiness of SSL certificates while verifying the identity of TLS hosts.
 python3-cgi - 3.8.5-2 - Python 3.8 cgi module
 python3-cgitb - 3.8.5-2 - Python 3.8 cgitb module
 python3-chardet - 3.0.4-4 - Universal encoding detector for Python 2 and 3
 python3-codecs - 3.8.5-2 - Python 3.8 codecs + unicode support
 python3-ctypes - 3.8.5-2 - Python 3.8 ctypes module
 python3-dbm - 3.8.5-2 - Python 3.8 dbm module
 python3-decimal - 3.8.5-2 - Python 3.8 decimal module
 python3-distutils - 3.8.5-2 - Python 3.8 distutils module
 python3-email - 3.8.5-2 - Python 3.8 email module
 python3-evdev - 1.4.0-2 - Bindings to the Linux input handling subsystem
 python3-gdbm - 3.8.5-2 - Python 3.8 gdbm module
 python3-gpiod - 1.4.0-2 - A fast and complete Python implementation of gpiod.
 python3-idna - 2.10-1 - A library to support the Internationalised Domain Names in Applications
  (IDNA) protocol as specified in RFC 5891. This version of the protocol
  is often referred to as "IDNA2008" and can produce different results
  from the earlier standard from 2003.
 python3-light - 3.8.5-2 - This package is essentially the python3-base package plus
  a few of the rarely used (and big) libraries stripped out
  into separate packages.
 python3-logging - 3.8.5-2 - Python 3.8 logging module
 python3-lzma - 3.8.5-2 - Python 3.8 lzma module
 python3-multiprocessing - 3.8.5-2 - Python 3.8 multiprocessing
 python3-ncurses - 3.8.5-2 - Python 3.8 ncurses module
 python3-numpy - 1.19.2-1 - NumPy is the fundamental package for array computing with Python.
 By default, this package is built without some modules.
  For some modules to be available, the INSTALL_GFORTRAN symbol needs
  to be enabled in the OpenWrt core/toolchain.
 python3-openssl - 3.8.5-2 - Python 3.8 SSL module
 python3-pillow - 7.2.0-1 - The friendly PIL fork
 python3-pip - 20.1.1-1 - Python 3.8 pip module
 python3-pkg-resources - 47.1.0-1 - Python 3.8 pkg_resources module (part of setuptools)
 python3-plumbum - 1.6.9-2 - A fast and complete Python implementation of plumbum.
 python3-pyasn1 - 0.4.8-2 - This is an implementation of ASN.1 types and codecs in Python programming
  language. It has been first written to support particular protocol (SNMP)
  but then generalized to be suitable for a wide range of protocols
  based on ASN.1 specification.
 python3-pydoc - 3.8.5-2 - Python 3.8 pydoc module
 python3-pyserial - 3.4-2 - This module encapsulates the access for the serial port. It provides backends
  for Python running on Windows, OSX, Linux, BSD (possibly any POSIX compliant
  system) and IronPython. The module named "serial" automatically selects the
  appropriate backend.
 python3-qrcode - 6.1-3 - Pure python QR Code generator
 python3-requests - 2.24.0-1 - Requests is the only Non-GMO HTTP library for Python, safe for human consumption
 python3-rpyc - 5.0.1-3 - rpyc
 python3-rsa - 4.6-1 - Is a pure-Python RSA implementation. It supports encryption and decryption,
  signing and verifying signatures, and key generation according to PKCS#1 version 1.5.
  It can be used as a Python library as well as on the commandline.
 python3-schedule - 0.6.0-2 - An in-process scheduler for periodic jobs that uses the builder pattern for configuration.
  The Schedule lets you run Python functions (or any other callable)
  periodically at predetermined intervals using a simple, human-friendly syntax.
 python3-setuptools - 47.1.0-1 - Python 3.8 setuptools module
 python3-six - 1.15.0-1 - Six is a Python 2 and 3 compatibility library.  It provides utility functions
  for smoothing over the differences between the Python versions with the goal of
  writing Python code that is compatible on both Python versions.  See the
  documentation for more information on what is provided.
 python3-spidev - 3.5-2 - Bindings to the Linux input handling subsystem
 python3-sqlite3 - 3.8.5-2 - Python 3.8 sqlite3 module
 python3-unittest - 3.8.5-2 - Python 3.8 unittest module
 python3-urllib - 3.8.5-2 - Python 3.8 URL library module
 python3-urllib3 - 1.25.10-1 - HTTP library with thread-safe connection pooling, file post, and more.
 python3-xml - 3.8.5-2 - Python 3.8 xml libs
 rwcheck - 1-1 - rwcheck to check read and write by CRC, just data correctness but not performance.
 sipeed_memtool - 0.0.1-1 - Sipeed tools memtool
 sipeed_update_dtb - 0.0.1-1 - Sipeed tools update_dtb
 spidev-test - 4.9.118-4.9.118 - SPI testing utility.
 terminfo - 5.9-3 - Terminal Info Database (ncurses)
 tinyalsa-lib - 1.1.1-34ffa583936aeb6938636c9c0a26a322b69b0d26 - TinyALSA is a small library to interface with ALSA in the Linux kernel.
  It provides a basic pcm and mixer API, and avoids supporting complex and
  unnecessary operations, that could be dealt with at a higher level.
 tinyalsa-utils - 1.1.1-34ffa583936aeb6938636c9c0a26a322b69b0d26 - This package contains utilities provided by TinyALSA.
 ubox - 2016-03-07-fd4bb41ee7ab136d25609c2a917beea5d52b723b - OpenWrt system helper toolbox
 ubus - 2016-01-26-619f3a160de4f417226b69039538882787b3811c - OpenWrt RPC client utility
 ubusd - 2016-01-26-619f3a160de4f417226b69039538882787b3811c - OpenWrt RPC daemon
 uci - 2016-02-02.1-1 - Utility for the Unified Configuration Interface (UCI)
 uclient-fetch - 2016-01-28-2e0918c7e0612449024caaaa8d44fb2d7a33f5f3 - Tiny wget replacement using libuclient
 wget - 1.20.1-3 - Wget is a network utility to retrieve files from the Web using http
  and ftp, the two most widely used Internet protocols. It works
  non-interactively, so it will work in the background, after having
  logged off. The program supports recursive retrieval of web-authoring
  pages as well as ftp sites -- you can use wget to make mirrors of
  archives and home pages or to travel the Web like a WWW robot.
  This package is built with SSL support.
 wpa-cli - 2017-11-08-2 - WPA Supplicant command line interface
 wpa-supplicant - 2017-11-08-2 - WPA Supplicant
 zlib - 1.2.8-1 - zlib is a lossless data-compression library.
  This package includes the shared library.

Das sieht doch recht vielversprechend aus. Ich habe in der Liste die alsa-utils entdeckt. Also mal mit opkg info alsa-utils die Details dazu aufrufen und mit opkg upgrade alsa-utils sicherheitshalber mal auf den neusten Stand bringen.

$opkg info alsa-utils
 Package: alsa-utils
 Version: 1.1.0-1
 Depends: libc, alsa-lib, libncurses, libpthread, libncursesw
 Status: unknown ok not-installed
 Section: utils
 Architecture: sunxi
 Maintainer: Ted Hess thess@kitschensync.net
 MD5Sum: 7f699bb1e7fd9efddc5ee766bfe9f5f5
 Size: 124310
 Filename: alsa-utils_1.1.0-1_sunxi.ipk
 Source: package/utils/alsa-utils
 Description: ALSA (Advanced Linux Sound Architecture) utilities

$opkg upgrade alsa-utils
 Installing alsa-utils (1.1.0-1) to root…
 Downloading http://mirror.sipeed.com/maix_ii/base/alsa-utils_1.1.0-1_sunxi.ipk.
 Installing libncursesw (5.9-3) to root…
 Downloading http://mirror.sipeed.com/maix_ii/base/libncursesw_5.9-3_sunxi.ipk.
 Configuring libncursesw.
 Configuring alsa-utils.

Folgende Dateien sind in alsa-utils enthalten.

 \usr\bin\alsamixer
 \usr\bin\alsaucm
 \usr\bin\amixer
 \usr\bin\aplay
 \usr\bin\arecord
 \usr\sbin\alsactl
 \usr\share\alsa\init\00main
 \usr\share\alsa\init\ca0106
 \usr\share\alsa\init\default
 \usr\share\alsa\init\hda
 \usr\share\alsa\init\help
 \usr\share\alsa\init\info
 \usr\share\alsa\init\test

Mit aplay kann man sehr einfach WAV Dateien abspielen. Also werde ich wohl mal eine Beispieldatei herunterladen und mit aplay abspielen.

$wget https://file-examples-com.github.io/uploads/2017/11/file_example_WAV_1MG.wav
 Connecting to file-examples-com.github.io (185.199.108.153:443)
 file_example_WAV_1MG 100% |*|  1048k  0:00:00 ETA
 $aplay file_example_WAV_1MG.wav
 Playing WAVE 'file_example_WAV_1MG.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Stereo

Das klappt ja schon mal ganz gut. Der Sound ist zwar nicht überwältigend, aber eigentlich habe ich jetzt auch keinen super Sound von dem kleinen Speaker erwartet. Ausserdem hat das WAV File nur eine 8kHz Sampling-Rate und da sollte man auch nicht zu viel erwarten.

Bei den installierten Dateien habe ich doch auch amixer gesehen. Also mal sehen, ob ich die Lautstärke ändern kann.

$amixer
 Simple mixer control 'External Speaker',0
   Capabilities: pswitch pswitch-joined
   Playback channels: Mono
   Mono: Playback [off]
 Simple mixer control 'LINEIN gain volume',0
   Capabilities: pswitch pswitch-joined
   Playback channels: Mono
   Mono: Playback [off]
 Simple mixer control 'LINEOUT volume',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 31
   Mono: 31 [100%]
 Simple mixer control 'Left Input Mixer LINEINL',0
   Capabilities: pswitch pswitch-joined
   Playback channels: Mono
   Mono: Playback [off]
 Simple mixer control 'Left Input Mixer MIC1 Boost',0
   Capabilities: pswitch pswitch-joined
   Playback channels: Mono
   Mono: Playback [off]
 Simple mixer control 'Left LINEOUT Mux',0
   Capabilities: enum
   Items: 'DACL_SINGLE' 'DACL_R'
   Item0: 'DACL_SINGLE'
 Simple mixer control 'MIC1 gain volume',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 31
   Mono: 23 [74%]
 Simple mixer control 'codec hub mode',0
   Capabilities: enum
   Items: 'hub_disable' 'hub_enable'
   Item0: 'hub_disable'
 Simple mixer control 'codec trigger capture time value',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 0
   Mono: 0 [0%]
 Simple mixer control 'codec trigger playback time value',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 0
   Mono: 0 [0%]
 Simple mixer control 'codec trigger substream mode',0
   Capabilities: enum
   Items: 'ADC_ASYNC' 'ADC_I2S_SYNC'
   Item0: 'ADC_ASYNC'
 Simple mixer control 'digital volume',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 63
   Mono: 0 [0%]

 $ amixer -q sset 'LINEOUT volume' 10%+
 $ amixer -q sset 'LINEOUT volume' 20%+
 $ amixer -q sset 'LINEOUT volume' 20%-
 $ amixer -q sset 'LINEOUT volume' 5%+
 $ amixer -q sset 'LINEOUT volume' 5%+
 $ amixer -q sset 'LINEOUT volume' 5%+
 $ amixer -q sset 'LINEOUT volume' 5%+

$amixer get 'LINEOUT volume'
 Simple mixer control 'LINEOUT volume',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 31
   Mono: 31 [100%]
 $amixer -q sset 'LINEOUT volume' 20%-
 $amixer get 'LINEOUT volume'
 Simple mixer control 'LINEOUT volume',0
   Capabilities: volume volume-joined
   Playback channels: Mono
   Capture channels: Mono
   Limits: 0 - 31
   Mono: 17 [55%]

Was die ganzen mixer hier bedeuten ist mir nicht ganz klar, aber mit dem ‚LINEOUT volume‘ Mixer konnte ich ganz einfach die Lautstärke anpassen.

Als nächstes könnte ich ja mal eine WAV Datei mit einer höheren Sampling Rate probieren und statt Musik einfach mal Sprache ausgeben lassen. Die Wahrscheinlichkeit, dass man mit dem Ding redet ist einfach höher als dass man es zum Musik-hören verwendet :-).

wget-ssl  https://www.pacdv.com/sounds/voices/let-me-out-of-here-1.wav
 --2021-04-28 05:57:40--  https://www.pacdv.com/sounds/voices/let-me-out-of-here-1.wav
 Resolving www.pacdv.com… 192.232.218.187
 Connecting to www.pacdv.com|192.232.218.187|:443… connected.
 HTTP request sent, awaiting response… 200 OK
 Length: 200196 (196K) 
 Saving to: 'let-me-out-of-here-1.wav'
 let-me-out-of-here-1.wav                          100%[===========================================================================================================>] 195.50K   361KB/s    in 0.5s
 2021-04-28 05:57:42 (361 KB/s) - 'let-me-out-of-here-1.wav' saved [200196/200196]
 aplay let-me-out-of-here-1.wav
 Playing WAVE 'let-me-out-of-here-1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

Das klappt auch erstaunlich gut. Mit der angepassten Lautstärke und der hohen sampling Rate kann man tatsächlich ganz Brauchbare Ergebnisse erzielen.

Da ich leider keine Möglichkeit gefunden habe, eine mp3 Datei auszugeben, bleibt wohl nur, ein Programm wie z.B. ffplay oder mpg123 zu compilieren. Da kein gcc installiert muss ich das später mal mit einem Cross-Compiler versuchen. Das könnte dann ein extra Post werden. Sollte ja nicht so schwierig sein für einen ARMv7 Prozessor mpg123 zu compilieren.

$cat  /proc/cpuinfo
 processor       : 0
 model name      : ARMv7 Processor rev 5 (v7l)
 BogoMIPS        : 48.00
 Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
 CPU implementer : 0x41
 CPU architecture: 7
 CPU variant     : 0x0
 CPU part        : 0xc07
 CPU revision    : 5
 Hardware        : sun8iw19
 Revision        : 0000
 Serial          : 0000000000000000

Also erst mal ohne MP3 weiter zum Mikrofon. Wo ein aplay installiert ist da ist normalerweise arecord auch nicht weit. Also mal sehen, ob Aufnahmegeräte verfügbar sind.

$arecord -l
 **** List of CAPTURE Hardware Devices ****
 card 0: sun8iw19codec [sun8iw19-codec], device 0: SUNXI-CODEC sun8iw19codec-0 []
   Subdevices: 1/1
   Subdevice #0: subdevice #0

Da ist also eine Karte von der gelesen werden kann. Das kann man ja direkt mal testen.

$arecord -f S16_LE -d 5 --device="hw:0,0" test-mic.wav
 Recording WAVE 'test-mic.wav' : Signed 16 bit Little Endian, Rate 8000 Hz, Mono
 arecord: pcm_read:2032: read error: I/O error

Schade da scheint noch etwas nicht ganz zu funktionieren. Auch googeln hat leider nicht viele brauchbare Ergebnisse zu Tage gefördert. Ich werde also mal bei Sipeed nachfragen müssen, ob es eine Lösung für das Problem gibt.
Falls ich eine Antwort erhalte werde ich hier im Blog darüber berichten.

Anhang

Hier noch ein paar Befehle, die auf meinem Sipeed MAIX-II Dock im PATH gefunden wurden.

 [                    crond                f2py3.8              ifconfig             lsb                  nc                   rb                   swapoff              true
 [[                   crontab              false                ifdown               lsmod                netifd               readelf.py           swapon               ubus
         curl                 fbviewer             ifstatus             lsusb                netmsg               readlink             switch_root          ubusd
 alogcat              cut                  fdisk                ifup                 lsx                  netstat              reboot               sx                   uci
 alsactl              date                 fgrep                init                 lsz                  newfs_msdos          reboot_efex          sync                 uclient-fetch
 alsamixer            dbclient             find                 insmod               maixpy3_config.py    nice                 replug_sensor.sh     sysctl               udhcpc
 alsaucm              dd                   flock                ip                   md5sum               nslookup             reset                syslogd              udpsvd
 amixer               devstatus            free                 iperf3               mdev                 ntpd                 resize               sz                   umount
 aplay                df                   fsck.ext2            jshn                 memtool              ntpd-hotplug         rm                   tail                 uname
 arecord              diff                 fsck.ext3            jsonfilter           micropython          opkg                 rmdir                tar                  uniq
 ash                  dirname              fsck.ext4            kflash               miniterm.pyc         opkg-key             rmmod                tcpsvd               update_dtb
 awk                  display              fsync                kill                 mkdir                passwd               route                tee                  uptime
 basename             dmesg                ftpd                 killall              mke2fs               pgrep                rpyc_classic.pyc     telnet               usleep
 blkid                dos2unix             grep                 klogd                mkfifo               pidof                rpyc_registry.pyc    telnetd              validate_data
 brctl                dropbear             gunzip               kmodloader           mkfs.ext2            ping                 rx                   test                 vi
 bunzip2              dropbearkey          gzip                 ldd                  mkfs.ext3            ping6                rz                   tftp                 wc
 busybox              du                   halt                 less                 mkfs.ext4            pip                  sb                   tftpd                wget
 bzcat                e2fsck               head                 ln                   mkfs.vfat            pip3                 scp                  time                 wget-ssl
 cat                  easy_install         hexdump              lock                 mknod                pip3.8               sed                  tinycap              which
 chgrp                easy_install-3       hostname             logd                 mkswap               pivot_root           seq                  tinymix              wpa_cli
 chmod                easy_install-3.8     hotplug.sh           logger               mktemp               poweroff             sh                   tinypcminfo          wpa_supplicant
 chown                echo                 hwclock              login                modinfo              printf               sha256sum            tinyplay             xargs
 chroot               egrep                i2cdetect            logread              modprobe             ps                   sleep                top                  yes
 civetweb             env                  i2cdump              lrb                  monitor-selfboot.sh  pwd                  sort                 touch                zcat
 clear                expr                 i2cget               lrx                  mount                python               ssh                  tr
 cmp                  f2py                 i2cset               lrz                  mtd                  python3              start-stop-daemon    traceroute
 cp                   f2py3                id                   ls                   mv                   python3.8            strings              traceroute6