Problem
To record a multichannel acoustic signal from a microphone array.
Solution
Multichannel recording requires an audio device that supports synchronized multichannel input. HARK currently supports the following devices (for more details and connection procedures, see chapter 8 of the HARK document).
Audio devices that can be accessed via Advanced Linux Sound Architecture (ALSA),
RASP series, System In Frontier, Inc.
TD-BD-16ADUSB, Tokyo Electron Device Ltd.
There are two methods to record a sound in HARK. One is by creating a HARK network, and another is by using a support tool called wios . These two methods are explained more in details below:
HARK provided two nodes: AudioStreamFromMic for obtaining sound from a recording device(A/D converter), and SaveRawPCM / SaveWavePCM for saving the waveforms (See HARK Document for more details on the nodes). A recording network can be created by directly connecting these two nodes. (See bsec:LearningHARK001]Learning sound recording for details).
HARK provided a support tool wios (Supported up to version 3.1, no longer supported from 3.2) for recording/playing sounds through ALSA, RASP, and TDBD. The best feature of wios is the ability to play and record a sound at the same time. In the current HARK localization and separation nodes, it is essential to measure beforehand the processes for transmitting sound from the sound source to each microphone (transfer function or impurse response). Because of that, being able to play-back audio signals for measurement while recording is necessary. In this section, only the procedure on how to record a sound is discussed. See the recipe Recording impulse response for details about measurement of impulse response.
After the HARK repository has been registered, wios can be installed by executing the command below: (See HARK installation instructions on how to register the repository).
sudo apt-get install wios
wios options has four categories. For a detailed description, see wios help by running wios without adding options.
:
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) (ALSA:0, TDBD:1, RASP:2)
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 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. To use a device that is unsupported by HARK, see Using an A/D converter unsupported by HARK.
See Recording impulse response for information about impulse response measurement.