How To Wiki
Advertisement

wikipedia:Advanced Linux Sound Architecture

This article explains how to record and playback audio and configure audio devices (sound cards) (the various inputs and outputs, route etc.) in GNU/Linux distributions (Operating Systems).

Most Linux distros ship with ALSA, which includes a suite of front-end application software utilities/tools, including: alsactl, amixer, and arecord/aplay.

alsamixer[]

This first app provides a nice (relatively-intuitive) Text-user-interface (TUI) interactive mixer.

simply type:

 alsamixer

Use arrow keys

F4 F5 to switch between capture (inputs) and outputs (F3)

gui[]

B.T.W. many graphical setups (desktop environments) provide a nice GUI "Mixer" that behaves and looks (is laid-out) much like the ones Windows users are familiar with. Look for the sound or speaker icon in the bottom-right of the desktop (near the "tray" or "notification area").


amixer[]

Finer control can be achieved with this command line app. It can be used (invoked) using script events.

 amixer set Line cap

if more than one card (or audio device) is detected by the system (the kernel / the ALSA stack)

add the "-c" switch to specify which card, starting numbering at 0. '0' is the default card

including "-c 0" on command line is effectively the same as omitting the "-c" switch all together.

 amixer -c 1 toggle Line cap

will reverse the boolean (on or off) settings for "Line" (the device?) 's input and output (capture and playback)(roles / modes)


man amixer (on the web)


alsactl[]

AlsaCTL (Alsa Control) will simply dump (in a JSON-like format) the current configuration status (state) of the ALSA system to a plain-text file.

 alsactl -f <path to save output file to> store

"store" is the operator (better w.c.:) mode / role // command.

the reverse (inverse) process can be achieved by loading (restoring) a configuration that's saved in a plain-text (JSON?) configuration file and making the current sound settings according to it with "restore"

alsactl -f (where is the config stored?) restore


first try:

 alsactl names

to list all (?cards / devices ?) (roles?) ("role" is my own word choice)


explanation

in ALSA terminology a "device" is a sub-set of a "card" right? in other words, a Creative Soundblaster box (piece of hardware (in most contexts, referred to as a _device_) is the "card" and each (w.c.?: "role" or "path") within that, such as "line", "mic", "S/PDIF" (direct-digital)

each "Line", "Master" "Mic" "S/PDIF" is a "device"
and for each of those, there are (two directions): output ("Playback") and input ("Record") (roles w.c.?)


man page for alsactl

aplay[]

arecord[]

The flip-side to aplay is arecord.

I used this succesfully:

arecord -D default:CARD=MP3 -V stereo -t wav -f dat (filename to save PCM stream to)

for "-D" switch you need to know the name of the card. (how to query available cards and get their precise names for use with alsa utils?)

In my experience, (from Oct 2013) the arch-based distros (live ones) detect the Creative SoundBLASTER MP3+ Model No. S80270 external USB sound card from Creative Labs fine, but other distros (what about Debian-based ones?)

Advertisement