Frequently Asked Questions

Flat
Linux: How to determine your audio card's, or USB mic's, maximum sampling rate
User: kmaclean
Date: 1/1/2010 11:41 am
Views: 137077
Rating: -22

To submit audio to VoxForge, you need to make sure you Sound Card and your Device driver both support a 48kHz sampling at 16 bits per sample.

You can use arecord, the command-line sound recorder (and player) for the ALSA sound-card driver.  It should be included with your Linux distribution (type in "man arecord" at the command line to confirm this).

The approach here is use the 'arecord' command to try to record your speech at a sampling rate higher than what your sound card supports.  arecord balks at this and will return an error message stating the maximum rate your sound card or usb mic can give you.  Details of this approach can be found near the end of this thread (go to the second page).  Many thanks to Robin for helping out on this one.

1. Sound Card or Integrated Audio

If you have a sound card or audio processing integrated into your motherboard, get a list of all the audio devices on your PC by executing this command:

$arecord --list-devices

You should get output similar to this: 

**** List of CAPTURE Hardware Devices ****
card 0: IXP [ATI IXP], device 0: ATI IXP AC97 [ATI IXP AC97]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

This says that my integrated audio card is on card 0, device 0.

Next, try to record your speech at a rate higher than what you think your highest recording rate might be (replacing the numbers in hw:0,0 with your card and device number):

$ arecord -f dat -r 60000 -D hw:0,0 -d 5 test.wav

The 60000 corresponds to a sampling rate of 60kHz.  Your output should look something like this: 

Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo
Warning: rate is not accurate (requested = 60000Hz, got = 48000Hz)
         please, try the plug plugin (-Dplug:hw:0,0)
Aborted by signal Interrupt...

This tells us that the maximum sampling rate supported on my integrated audio card is 48000Hz (or 48kHz).  You may have to experiment with different sampling rates to get the Warning message. 

2. USB Microphone or USB audio pod

If you have USB based audio, first get a list of all the audio devices on your PC using this command:

$ arecord --list-devices

You should get a listing similar to this:

[...]
card 1: default [Samson C01U              ], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

This says that the USB microphone is is on card 1, device 0. 

Next, try to record your speech at a rate higher than what you think your highest recording rate might be (replacing the numbers in hw:1,0 with your card and device number):

$  arecord -f S16_LE -r 60000 -D hw:1,0 -d 5 testS16_LE.wav

"S16_LE" means 'Signed 16 bit Little Endian'.  This command will output something like this: 

Recording WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 60000 Hz, Stereo
Warning: rate is not accurate (requested = 60000Hz, got = 48000Hz)
         please, try the plug plugin (-Dplug:hw:0,0)
Aborted by signal Interrupt...

The arecord output tells us that the maximum sampling rate supported on my integrated audio card is 48000Hz (or 48kHz).  You may have to experiment with different sampling rates to get the Warning message.

There is some additional information on USB mics on the Audacity site.

Re: Linux: How to determine your audio card's, or USB mic's, maximum sampling rate
User: kmaclean
Date: 7/3/2015 7:09 pm
Views: 1273
Rating: 5

use pulseaudio pactl command:

$ pactl list short sinks

0    alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1    module-alsa-card.c    s16le 2ch 44100Hz    SUSPENDEDs16le
1    alsa_output.pci-0000_00_14.2.analog-stereo    module-alsa-card.c    s16le 2ch 44100Hz    RUNNINGs16le

PreviousNext