Difference between revisions of "OE Audio Progs"

From wiki.emacinc.com
Jump to: navigation, search
m (Made a couple of small notes and marked Buggy.)
m (Fixed spacing in cli* template uses.)
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{todo| Buggy (11.12.2015-11:13->KY+);(11.16.2015-15:05->MD-)|Klint Youngmeyer| project=OE 5.0,KY,Buggy,MG,MD }}
+
{{todo| Complete (11.12.2015-11:13->KY+);(11.16.2015-15:05->MD-)(11.17.2015-14:38->KY+)(11.17.2015-15:25->MD+);(11.17.2015-15:45->MG+)|Klint Youngmeyer| project=OE 5.0,KY,Complete,MG,MD }}
 
{{#seo:
 
{{#seo:
 
|title=Audio Programs
 
|title=Audio Programs
Line 21: Line 21:
 
::[[File:Alsamixer_screen.jpg|600px|thumb|left|Figure 1: Example of <code>alsamixer</code>]]
 
::[[File:Alsamixer_screen.jpg|600px|thumb|left|Figure 1: Example of <code>alsamixer</code>]]
 
<br clear=all>
 
<br clear=all>
   * <code>alsactl</code> is used to control advanced settings for the ALSA soundcard drivers. It supports multiple soundcards. Also, the <code>alsactl store</code> command is used to store driver setup and changes made in <code>alsamixer</code> to the static configuration file. 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.
+
   * <code>alsactl</code> is 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.
 
{{clo}}
 
{{clo}}
{{clio | hostname=emac-oe | oemntrw }}
+
{{clio | hostname=emac-oe |oemntrw }}
{{clio | hostname=emac-oe | alsamixer }}
+
{{clio | hostname=emac-oe |alsamixer }}
&#35;make necessary changes...
+
&#35; make necessary changes...
  
{{clio | hostname=emac-oe | alsactl store }}
+
{{clio | hostname=emac-oe |alsactl store }}
{{clio | hostname=emac-oe | oemntrw -r}}
+
{{clio | hostname=emac-oe |oemntrw -r}}
 
{{clos}}
 
{{clos}}
  
:Aside from the store function, <code>alsactl</code> has a few other commands available. The <code>restore</code> command is used to load current driver setup for one or each soundcards from configuration file, the <code>init</code> command initialize driver and settings to a default state, and the <code>names</code> command dumps information about all the known present (sub-)devices into configuration file (<code>names</code> command is deprecated)
+
:Aside from the store function, <code>alsactl</code> has a few other commands available. The <code>alsactl store</code> command is used to store driver setup and changes made in <code>alsamixer</code> to the static configuration file. The <code>restore</code> command is used to load current driver setup for one, or each, soundcard from the configuration file; the <code>init</code> command initializes driver and settings to a default state.
 
   * <code>aplay</code> is 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.
 
   * <code>aplay</code> is 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.
   * <code>arecord</code> is 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 samples the file is automatically split before the 2GB filesize.
+
   * <code>arecord</code> is 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.
 
   * <code>speaker-test</code> generates a series of sounds from the different channels of the default (or user specified) audio device. Some example tests are as follows:
 
   * <code>speaker-test</code> generates a series of sounds from the different channels of the default (or user specified) audio device. Some example tests are as follows:
 
</cl>
 
</cl>
 
:Outputting a voice identifying each channel
 
:Outputting a voice identifying each channel
{{cli | hostname=emac-oe | speaker-test -t wav -l 1 -c 2}}
+
{{cli | hostname=emac-oe |speaker-test -t wav -l 1 -c 2}}
 
:Outputting a sine wave tone to each channel
 
:Outputting a sine wave tone to each channel
{{cli | hostname=emac-oe | speaker-test -t sine -l 1 -c 2 -f 550}}
+
{{cli | hostname=emac-oe |speaker-test -t sine -l 1 -c 2 -f 550}}
  
 
==mpg123==
 
==mpg123==
Line 46: Line 46:
 
To play an audio file from the command line, <code>mpg123</code> must be passed the name of the file to be played.
 
To play an audio file from the command line, <code>mpg123</code> must be passed the name of the file to be played.
  
{{cli | hostname=emac-oe | mpg123 sound_file.mp3}}
+
{{cli | hostname=emac-oe |mpg123 sound_file.mp3}}
  
This method, while great for shell scripts (but see below), does not support any control of the output after the file has begun output by a human operator. To enable manual controls, the <code>-C</code> flag must be used.
+
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 <code>-C</code> flag must be used.
  
{{cli | hostname=emac-oe | mpg123 -C sound_file.mp3}}
+
{{cli | hostname=emac-oe |mpg123 -C sound_file.mp3}}
  
 
A few of the supported command keys are:
 
A few of the supported command keys are:
Line 61: Line 61:
 
If <code>mpg123</code> needs to be run from a script, or run in the background, the <code>-q</code> flag should be used to enable quiet output so that nothing is printed to the screen when a the file is played.
 
If <code>mpg123</code> needs to be run from a script, or run in the background, the <code>-q</code> flag should be used to enable quiet output so that nothing is printed to the screen when a the file is played.
  
{{cli | hostname=emac-oe | mpg123 -q sound_file.mp3}}
+
{{cli | hostname=emac-oe |mpg123 -q sound_file.mp3}}
  
 
There are a large number of other options that are available when using <code>mpg123</code>; too many to list in this document. These options can be viewed by passing the <code>--help</code> flag to the program.
 
There are a large number of other options that are available when using <code>mpg123</code>; too many to list in this document. These options can be viewed by passing the <code>--help</code> flag to the program.
  
{{cli | hostname=emac-oe | mpg123 --help}}
+
{{cli | hostname=emac-oe |mpg123 --help}}
 
+
<!-- /*********************************************************************************************************/ -->
 +
<!-- /******************************************    Conclusion      ******************************************/ -->
 +
<!-- /*********************************************************************************************************/ -->
 +
{{:Templateimpl:conclusion | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}
 +
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_Services|EMAC Support]] for details.
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************  More Information  *****************************************/ -->
 
<!-- /******************************************  More Information  *****************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
{{:Templateimpl:moreinfo | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}
+
<!--{{:Templateimpl:moreinfo | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}
*  
+
* -->
{{ warning | This looks unfinished.}}
 
 
{{:Templateimpl:whatnext | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}
 
{{:Templateimpl:whatnext | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}
 
* [http://www.alsa-project.org/main/index.php/Documentation ALSA Official Documentation]
 
* [http://www.alsa-project.org/main/index.php/Documentation ALSA Official Documentation]
Line 92: Line 95:
 
<!-- /*********************************************************************************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!--{{:Templateimpl:examples | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}-->
 
<!--{{:Templateimpl:examples | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}-->
<!-- /*********************************************************************************************************/ -->
 
<!-- /******************************************    Conclusion      ******************************************/ -->
 
<!-- /*********************************************************************************************************/ -->
 
<!--{{:Templateimpl:conclusion | initials=KY | title=Audio Programs | desc=Audio programs included with EMAC OE5.X | project=OE 5.0 }}-->
 
 
{{ warning | This should have some sort of conclusion, even if it's simple.  Some readers always read the conclusion first to see if they want to read the rest.}}
 

Latest revision as of 20:36, 24 November 2015

TODO: {{#todo: Complete (11.12.2015-11:13->KY+);(11.16.2015-15:05->MD-)(11.17.2015-14:38->KY+)(11.17.2015-15:25->MD+);(11.17.2015-15:45->MG+)|Klint Youngmeyer|OE 5.0,KY,Complete,MG,MD}}

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

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.

  • alsamixer is an ncurses mixer program for use with the ALSA soundcard drivers. It supports multiple soundcards with multiple devices. The alsamixer menu 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 alsamixer interface is shown in Figure 1.


Figure 1: Example of alsamixer


  • alsactl is 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.

root@emac-oe:~# oemntrw
root@emac-oe:~# alsamixer

# make necessary changes...

root@emac-oe:~# alsactl store
root@emac-oe:~# oemntrw -r
Aside from the store function, alsactl has a few other commands available. The alsactl store command is used to store driver setup and changes made in alsamixer to the static configuration file. The restore command is used to load current driver setup for one, or each, soundcard from the configuration file; the init command initializes driver and settings to a default state.
  • aplay is 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.

  • arecord is 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-test generates 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
root@emac-oe:~# speaker-test -t wav -l 1 -c 2
Outputting a sine wave tone to each channel
root@emac-oe:~# speaker-test -t sine -l 1 -c 2 -f 550

mpg123

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.

root@emac-oe:~# mpg123 sound_file.mp3

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.

root@emac-oe:~# mpg123 -C sound_file.mp3

A few of the supported command keys are:

  • q = Quit
  • s = Stop/Start
  • + = Volume Up
  • - = Volume Down
  • h = Display all terminal control keys

If 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.

root@emac-oe:~# mpg123 -q sound_file.mp3

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.

root@emac-oe:~# mpg123 --help

Conclusion

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