dcsimg

Better Linux Sound Managment With ALSA, Part 2: Page 2

Last week we learned how to configure soundcards for playback with ALSA. Now we're going to use ALSA for recording, and learn how to test our sound system.
(Page 2 of 3)

How do you know what type of output your sound card supports? aplaytells the tale:

$ aplay -L
front:CARD=V8237,DEV=0
    VIA 8237, VIA 8237
    Front speakers
surround40:CARD=V8237,DEV=0
    VIA 8237, VIA 8237
    4.0 Surround output to Front and Rear speakers
surround41:CARD=V8237,DEV=0
    VIA 8237, VIA 8237
    4.1 Surround output to Front,
        Rear and Subwoofer speakers
surround50:CARD=V8237,DEV=0
    VIA 8237, VIA 8237
    5.0 Surround output to Front, 
        Center and Rear speakers
surround51:CARD=V8237,DEV=0
    VIA 8237, VIA 8237
    5.1 Surround output to Front, Center, 
       Rear and Subwoofer speakers
iec958:CARD=V8237,DEV=0
    VIA 8237, VIA 8237
    IEC958 (S/PDIF) Digital Audio Output

If you ever need to specify the PCM device, this is where you find it: front, surround40, surround41, and so forth are PCM devices that should have been created automatically at startup. You could test these with aplay, like this:

$ aplay -D front test.wav

Playing WAVE 'test.wav' : Signed 16 bit Little Endian,
 Rate 44100 Hz, Stereo

You may also also test playback by using the card+device numbers. This is sort of a "raw" test, since it doesn't depend on having a correct PCM devices configuration, but uses the card IDs assigned by the kernel. aplay -lshows the "raw" card+device numbers. 0,0 is the first device, 1,0 is the second device, and so on:

$ aplay -D hw:1,0 test.wav

If you have a second sound device, such as a USB headset, you can configure the PCM device names either globally in /etc/asound.conf or per-user in ~.asoundrc. Something as simple as this works just fine:

pcm.v8237 {type hw card V8237}
ctl.v8237 {type hw card V8237}
pcm.headset {type hw card Headset}
ctl.headset {type hw card Headset}

For pcm.v8237, the pcm part is required. The v8237 can be anything you want, and the same goes for the ctl lines. type hw card is required; V8237 and Headset come from the output of aplay -l. You could also use asoundconf:

$ asoundconf list
Names of available sound cards:
V8237
Headset

Now instead of using aplay -D hw:1,0 test.wav I can use aplay -D headset test.wav. You want to use the names (V8237, Headset) in your configuration file instead of the kernel IDs (0,0- 1,0), because the kernel IDs can change, especially udev devices.

Next: Recording With ALSA »


Page 2 of 3

Previous Page
1 2 3
Next Page





0 Comments (click to add your comment)
Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 

IT Management Daily
Don't miss an article. Subscribe to our newsletter below.

By submitting your information, you agree that datamation.com may send you Datamation offers via email, phone and text message, as well as email offers about other products and services that Datamation believes may be of interest to you. Datamation will process your information in accordance with the Quinstreet Privacy Policy.