Tuesday, June 26, 2018

Capturing audio from microphone on Raspberry Pi (Debian)

Initial conditions:

1) Debian Linux on Raspberry Pi (arm7)
2) Logitech USB Microphone

So, first of all:

1. Installing ALSA, SOX using apt-get.
 
Actual capturing performed by following command:

 > sox -t alsa default recording.wav

If you'll get an error:

sox FAIL formats: can't open input  `default': snd_pcm_open error: No such file or directory

It means that default audio capturing device is not specified. Solution is here.

Creating file .asoundrc in home directory with following contents:

pcm.!default {
  type hw
  card 1
}


where card ID (in our case 1) - taken from /proc/asound/cards:

 0 [ALSA           ]: BRCM bcm2835 ALSbcm2835 ALSA - bcm2835 ALSA
                      bcm2835 ALSA
 1 [AK5370         ]: USB-Audio - AK5370
                      AKM AK5370 at usb-bcm2708_usb-1.2, full speed

No comments:

Post a Comment