5.1 Recording multichannel sound

Problem

To record multichannel sound from a microphone array.

Solution

HARK-supported devices

 
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).

ALSA

Audio device that can access via Advanced Linux Sound Architecture (ALSA),

RASP

RASP series, System In Frontier, Inc.

TDBD

TD-BD-16ADUSB, Tokyo Electron Device Ltd.

Two recording methods

 
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.

Recording using a HARK network

 
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).

Recording using wios  

 
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.

Mode options

:

Three modes: playing mode(-p), recording mode(-r), and synchronized-playing-and-recording mode(-s). Use -t to specify the duration.

File options

:

File name for playing, (D/A) (-i); for recording (A/D) (-o).
Quantization bit rate (-e), sampling frequency(-f), number of channels(-c)

Device options

:

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).

Device-dependent options

:

Examples: ALSA: Buffer size; TDBD: Gain; RASP: Gain. See wios  help for a complete list.


Examples:

 

  • Using a RASP device with an IP address of 192.168.1.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

    2. Play the wave file input.wav
      wios -p -x 2 -d 192.168.1.1 -i input.wav

    3. 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, ...

    1. Record monaural sound for 10 seconds
      wios -r -x 0 -t 10 -c 1 -o output.wav

    2. 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.