By default, EMAC OE 5.X comes with two audio packages: ALSA and mpg123. More packages and applications are available from EMAC at a customer's request.
ALSA, or the Advanced Linux Sound Architecture, is a part of the Linux Kernel and is a software framework that provides an API for sound devices. The ALSA framework includes several applications for working with sound.
alsamixeris an ncurses mixer program for use with the ALSA soundcard drivers. It supports multiple soundcards with multiple devices. The
alsamixermenu displays a volume bar for each audio device present on the system. Adjusting these volume bars (with the arrow keys and 'm' for mute) allows changing of the output or input device volume corresponding to the given bar. An example of the
alsamixerinterface is shown in Figure 1.
alsactlis used to control advanced settings for the ALSA soundcard drivers. It supports multiple soundcards. The following example demonstrates changing the settings for the default sound card by remounting the filesystem read-write, changing the settings, storing them, then remounting the filesystem read-only.
- Aside from the store function,
alsactlhas a few other commands available. The
alsactl storecommand is used to store driver setup and changes made in
alsamixerto the static configuration file. The
restorecommand is used to load current driver setup for one, or each, soundcard from the configuration file; the
initcommand initializes driver and settings to a default state.
aplayis a command-line soundfile player for the ALSA soundcard driver. It supports several file formats and multiple soundcards with multiple devices. For supported soundfile formats, the sampling rate, bit depth, and so forth can be automatically determined from the soundfile header.
arecordis a command-line soundfile recorder for the ALSA soundcard driver. It supports several file formats and multiple soundcards with multiple devices. If recording with interleaved mode sampling, the file is automatically split before the 2GB filesize.
speaker-testgenerates a series of sounds from the different channels of the default (or user specified) audio device. Some example tests are as follows:
- Outputting a voice identifying each channel
- Outputting a sine wave tone to each channel
mpg123 is a simple and lightweight command line mp3 player. It is designed for use in front ends, in shell scripts, as an mp3 player, and as an mp3 to wave file decoder (primarily for use with CD-recording software).
To play an audio file from the command line,
mpg123 must be passed the name of the file to be played.
This method, while great for shell scripts (but see below), does not support any control of the output once playback has been initiated by a human operator. To enable manual controls, the
-C flag must be used.
A few of the supported command keys are:
- q = Quit
- s = Stop/Start
- + = Volume Up
- - = Volume Down
- h = Display all terminal control keys
mpg123 needs to be run from a script, or run in the background, the
-q flag should be used to enable quiet output so that nothing is printed to the screen when a the file is played.
There are a large number of other options that are available when using
mpg123; too many to list in this document. These options can be viewed by passing the
--help flag to the program.
This page demonstrates some of the basic audio functionality that is included with EMAC OE. The combination of ALSA and mpg123 should accommodate most typical commandline oriented audio needs. If any further audio features are required, EMAC can support them. Please contact EMAC Support for details.
Pages with Related Content