5.1 Recording multichannel sound

Problem

To record a multichannel acoustic signal from a microphone array.

Solution

HARK-supported devices

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

ALSA

Audio devices that can be accessed via Advanced Linux Sound Architecture (ALSA),

RASP

RASP series, System In Frontier, Inc.

TDBD

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

Two recording methods

 
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:

Recording using a HARK network

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

Recording using wios  

 
HARK provided a support tool wios  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.

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