Problem
To record multichannel sound from a microphone array.
Solution
Multichannel recording requires an audio device supporting multichannel input. HARK currently supports the following devices (for details, see the chapter on devices in the HARK document).
Audio device that can access via Advanced Linux Sound Architecture (ALSA),
RASP series, System In Frontier, Inc.
TD-BD-16ADUSB, Tokyo Electron Device Ltd.
Using HARK, sound can be recorded in two ways , by using a HARK network, and by recording using wios , a support tool provided by HARK.
HARK provides two nodes AudioStreamFromMic , which gets sound from a recording device, and SaveRawPCM / SaveWavePCM , which saves waveforms. You can build a recording network by connecting these nodes directly (see Learning sound recording for details about networks, and HARK documents for details about these nodes).
HARK provides a support tool wios for recording/playing sounds through ALSA, RASP, and TDBD. The ability of wios to synchronously play and record a sound enables its use for measuring impulse responses, i.e., propagation from a sound source to a microphone, because it can to play a special signal and record the sound simultaneously. This recipe describes how to use wios for recording; to use wios to measure impulse responses, see Recording impulse response. You can install wios with the following command if you registered the HARK repository in your system. (See HARK installation instructions).
sudo apt-get install wios
wios options has four categories; for a detailed description, see wios help by running wios with no alterations.
Three modes playing mode(-p), recording mode(-r), and synchronized-playing-and-recording mode(-s). Use -t to specify the duration.
File name for playing, (D/A) (-i); for recording (A/D) (-o).
Quantization bit rate (-e), sampling frequency(-f), number of channels(-c)
Device type specification (-x) (ALSA0, TDBD1, RASP2)
Device specification (-d). The meaning of this option depends on which type of device is specified. -d is the device name for ALSA (default plughw:0,0), TDBD (default /dev/sinchusb0), and the IP address for RASP (default 192.168.33.24).
Examples ALSA Buffer size; TDBD Gain; RASP Gain. See wios help for a complete list.
Using a RASP device with an IP address of 192.168.1.1, ...
Record sound with 8 channel for 3 seconds and save it to output.wav.
wios -r -x 2 -t 3 -c 8 -d 192.168.1.1 -o output.wav
Play the wave file input.wav
wios -p -x 2 -d 192.168.1.1 -i input.wav
Play tsp.wav and synchronously record the sound and save it to response.wav
wios -s -x 2 -d 192.168.1.1 -i tsp.wav -o response.wav
Using an ALSA-supported sound card installed in a computer, ...
Record monaural sound for 10 seconds
wios -r -x 0 -t 10 -c 1 -o output.wav
Play output.wav
wios -p -x 0 -i output.wav
See Also
See Learning sound recording for a detailed description of sound recording sound using the HARK network. If recording fails, see Sound recording fails for troubleshooting.
For ALSA, RASP, and TDBD, see the chapter about devices in the HARK document. If you want to use a device unsupported by HARK, see Using an A/D converter unsupported by HARK.
See Recording impulse response for information about impulse response measurement.