14.2.1 Stereo recording with ALSA-based devices

Execute demoALSA_2ch.sh in the Record directory. After the execution, one stereo file rec_all_0.wav and two monaural files rec_each_0.wav, rec_each_1.wav are generated. When replaying these files, the recorded content can be confirmed.

Some computer rarely do not accept stereo recording so an error may occur. In the case that the sound recording cannot be performed well even though the computer is able to accept stereo recording, confirm the check items for monaural sound recording. Five modules are included in this sample. There is one module in MAIN (subnet) and are four modules in MAIN_LOOP (iterator). It is simple network configuration in which the audio waveforms collected in the AudioStreamFromMic module are written in a file in SaveWavePCM . Data formats between modules are uniformed through MatrixToMap . Iterate is a module that indicates that the execution is repeated for the number of times set by the user. Designate the number of frames to be collected and adjust sound recording time. What is different from the monaural sound recording network is the only CHANNEL_COUNT property of the AudioStreamFromMic module. It is 1 for monaural recording and 2 for stereo recording.

Recording cannot be performed well, perform the following checks.

  1. Confirm if the sound is replayed or recorded with software other than HARK. If the sound cannot be replayed or recorded, the OS and driver, and audio interface may not be properly set or connected so check them.

  2. The microphones are properly connected. Confirm if the plugs are not unplugged or loosened and connect them properly.

  3. Check if the microphone terminals of the computer accept plug in power. If they do not accept plug in power, it is necessary to supply a power to the microphones. For battery type microphones, set batteries and switch on. For battery box type microphones, connect battery boxes and switch on.

  4. When more than two audio interfaces are connected, remove audio interfaces after the second ones before recording the sound. If recording cannot be performed with one audio interface, change the property of demo.n. For the DEVICE property of the AudioStreamFromMicmodule, try setting of 0,0 plughw:0,1 plughw:0,2.

Parameters of AudioStreamFromMic are shown in Table 14.4. In this module, designate a sound recording device. Designate a sound recording device in this module. In this demo, the number of sound recording channels is 2ch so that a lot of users can check the operation, and ALSA is designated for DEVICETYPE and plughw:0,0 is designated for DEVICE.

Table 14.4: Parameter list of AudioStreamFromMic 

Parameter name

type

Set value

Unit

Description

LENGTH

subnet_param 

LENGTH

[pt]

FFT length

ADVANCE

subnet_param 

ADVANCE

[pt]

Shift length

CHANNEL_COUNT

int 

2

[ch]

Number of sound recording channel

SAMPLING_RATE

subnet_param 

16000

[Hz]

Sampling frequency

DEVICETYPE

string 

ALSA

 

Device type

DEVICE

string 

plughw:0,0

 

Device name