Using alsa for audio capture and playback – Sensoray 2253 Linux User Manual
Page 11

Using ALSA for audio capture and playback
The driver provides an ALSA card interface for raw PCM, g.711 u-law and
A-law audio capture. The ALSA device operates independently of the video
capture device.
To find out the ALSA name of the 2253 board, use the program “arecord -l”:
**** List of CAPTURE Hardware Devices ****
card 1: s2253 [Sensoray 2253], device 0: s2253 [Sensoray 2253]
Subdevices: 1/1
Subdevice #0: subdevice #0
Here we see card 1 device 0 is the 2253, so it can be referred to as “hw:1,0”.
To record audio, use the arecord program and specify the device, format,
sample rate, and number of channels. For example:
PCM 16-bit stereo: arecord -D hw:1,0 -f S16_LE -r 48000 -c 2 output.pcm
g.711 A-law mono: arecord -D hw:1,0 -f A_LAW -r 8000 -c 1 output.g711
g.711 mu-law mono: arecord -D hw:1,0 -f MU_LAW -r 8000 -c 1 output.g711
Use
For more detailed options, see the man page: “man arecord”.
To play back recorded audio on the host, use the aplay program and specify
the same settings used to record. For example:
PCM 16-bit stereo: aplay -f S16_LE -r 48000 -c 2 output.pcm
g.711 A-law mono: aplay -f A_LAW -r 8000 -c 1 output.g711
g.711 mu-law mono: aplay -f MU_LAW -r 8000 -c 1 output.g711
To adjust the volume and audio input, use the alsamixer command. For
example, if the 2253 ALSA card number is 1, use the -c option “alsamixer -c
1”. Use the tab key to select [All] interface, and arrow keys to select the
setting to change. There are two volume controls, for Playback and Capture.
The Input AGC setting is Automatic Gain Control for left and right channels – it
is important to note that the volume controls have no effect when AGC is
enabled. The Input Source setting allows you to select either the Mic or Line
In input source. Press ESC to exit alsamixer.
In addition to the command-line utilities, any ALSA-compliant application
should be able to record and change the settings of the 2253 device.
The volume and input source settings are per-board settings and will also
affect the AAC audio of any MP4 or MPEG-TS streams being captured.
11