19

I'm having some mixed results with the arecord command in the terminal. The hardware I'm using consists of the Cirrus Audio Card for the Raspberry Pi. I'm trying to record a 24-bit 192kHz sound (from the onboard MIC) into a WAV file, and then play it back (through the headset). First I make sure to enable the MIC and headset:

$ ./Record_from_DMIC.sh
$ ./Playback_to_Headset.sh

Then I tried multiple commands, and got mixed results.

$ arecord -f S24_LE -r 192 -d 20 test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono
$ arecord: set_params:1087: Channels count non available
# So I set the number of channels to 1 (even though it is that, by default)
$ arecord -c 1 -f S24_LE -r 192 -d 20 test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 192000 Hz, Mono
arecord: set_params:1087: Channels count non available

Still get the same error. I got rid of the rate (192kHz), and let it default:

$ arecord -d 10 -c 1 -f S24_LE -t wav test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 8000 Hz, Mono
$ arecord: set_params:1087: Channels count non available

Still getting the same error. So I just used an example run of the command I found online (http://linux.die.net/man/1/arecord):

$ arecord -d 10 -f cd -t wav test.wav
Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

This worked. But clearly used different values than from what I wanted. I also had trouble playing at 192kHz:

$ aplay -c 1 -r 192000 test.wav 
Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

I try to play at 192kHz, but it goes down to 44.1kHz. Does anyone have any idea as to why I'm getting all these weird errors and results?

5
  • What is the output of aplay --dump-hw-params and aplay -D hw:0 --dump-hw-params?
    – CL.
    Mar 26, 2015 at 8:05
  • I get this for either command: aplay: unrecognized option '--dump-hw-params' Try 'aplay --help' for more information
    – Max Jacob
    Mar 26, 2015 at 17:16
  • Then your distribution's alsa-utils package is not up to date. Anyway, the hardware apparently supports only stereo.
    – CL.
    Mar 26, 2015 at 20:38
  • Doesn't stereo specifically refer to multiple channels (as in, sound coming from multiple locations)? Why would that pertain to the sample-rate (192kHz)?
    – Max Jacob
    Mar 27, 2015 at 1:48
  • There is no sample rate problem. (When playing a .wav file, the rate is always taken from the file.)
    – CL.
    Mar 27, 2015 at 7:33

1 Answer 1

36

I found out what the problem was. The command defaults because I wasn't specifying a 2-channel (stereo) 192kHz audio input. Here's an example of a command that did work:

$ arecord -f S24_LE -c 2 -r 192000 -d 20 test.wav

The -c 2 is what fixed my commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.