14.2.1 Ubuntu

Four kinds of sound recording network samples are available as shown in Table 14.2. The left column indicates network files and the right column indicates processing contents.

Table 14.2: Sound recording network list.

Network file name

Processing content

demoALSA.n

ALSA sound recording

demoWS_8ch.n

Sound recording for eight channels with RASP

demoRASP24_8ch.n

Sound recording for eight channels with RASP24

For ALSA devices, you can use a shell script demoALSA.sh for recording various number of frames, number of channels, and device names. For example, if you want to record 200 frames from an 2-ch audio device whose name is plughw:1,0, you can use this script as shown below:

> ./demoALSA.sh 200 2 plughw:1,0
 UINodeRepository::Scan()
 Scanning def /usr/lib/flowdesigner/toolbox
 done loading def files
 loading XML document from memory
 done!
 Building network  :MAIN
 
 <Bool 1 >
Figure 14.2: Execution example of demoALSA.sh.

Note that the difference between these networks is only the parameters of AudioStreamFromMic module. The DEVICE parameter (plughw:1,0, 127.0.0.1, etc.) changes according to an environment. Therefore, an user has to set correct value.

A sample network consists of two sub-networks (MAIN, MAIN_LOOP). MAIN (subnet) and MAIN_LOOP (iterator) have one and six modules, separately. Figure 14.3 and 14.4 shows MAIN (subnet) and MAIN_LOOP (iterator). It is simple network configuration in which the audio waveforms collected in the AudioStreamFromMic module are selected in ChannelSelector , and written in files in SaveWavePCM . The SaveWavePCM module connected to OUTPUT1 saves a file with eight channel signal. The other SaveWavePCM module saves eight files with each channel signal.

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.

\includegraphics{fig/recipes/demo-Record-MAIN.png}
Figure 14.3: MAIN (subnet)
\includegraphics[width=\textwidth ,clip]{fig/recipes/demo-Record-MAIN_LOOP.png}
Figure 14.4: MAIN_LOOP (iterator)

There are five properties for the MAIN_LOOP node in MAIN (subnet). Table 14.3 shows a list of them. SAMPLING_RATE and GET_FRAMES are important. Each parameter value is set according to the values in the table. Set value of GET_FRAMES is int :ARG1 here. This means the monobasic argument of demoALSA_2ch.n casted to the integral type and substituted. The number of sound recording frames is given to this argument in demoALSA_2ch.n in demoALSA_2ch.sh. Designate sound recording time length as the number of frames acquired and the actual sound recording time length is expressed in sec as follows.

  $\displaystyle $ $\displaystyle $ $\displaystyle ( LENGTH + (GET\_ FRAMES - 1) * ADVANCE ) / SAMPLING\_ RATE $   (1)
Table 14.3: Parameter list of MAIN_LOOP

Parameter name

Type

Set value

Unit

Description

ADVANCE

int 

160

[pt]

Shift Length

LENGTH

int 

512

[pt]

FFT length

SAMPLING_RATE

int 

16000

[Hz]

Sampling frequency

GET_FRAMES

subnet_param 

int :ARG1

 

Number of frames for sound recording

DOWHILE

bool 

   

Blank

14.2.1.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 nodes are included in this sample. There is one node in MAIN (subnet) and are four nodes 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 nodes are uniformed through MatrixToMap . Iterate is a node 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 node. 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 node, designate a sound recording device. Designate a sound recording device in this node. 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

14.2.1.2 8ch sound recording with radio RASP

Execute demoWS_8ch.sh in a Record directory, after setting several items. Although 127.0.0.1 is designated as an IP address of the radio RASP in demoWS_8ch.n, it is necessary to change this to an appropriate IP address. If configuration of FPAA for the radio RASP is not completed yet, complete it here. See the document of radio RASP for the method to execute ws_fpaa_config. After the execution, one file rec_all_0.wav and eight monaural files rec_each_0.wav, rec_each_1.wav, ..., rec_each_7.wav are generated. When replaying these files, the recorded content can be confirmed.

When recording cannot be performed well, perform the following checks.

  1. Check if the microphones are properly connected. Check if the plugs are not unplugged or loosened and connect them properly.

  2. The network connection is established with the IP address of RASP. Check the network connection with ping.

  3. A correct IP address of RASP is set to AudioStreamFromMic .

  4. Initialization of FPAA of RASP is completed.

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

Parameters of AudioStreamFromMic are shown in Table 14.5. Designate a sound recording device in this node. Designate a multi-channel sound recording device. Set 16ch to the number of sound recording channel, designate WS, which indicates radio RASP, in DEVICETYPE and an IP address in DEVICE. In order to execute the sample, it is necessary to change the address to that of the actual radio RASP.

Note that when WS is used, CHANNEL_COUNT must be 16. Therefore, when a user want to record eight channel sound with WS, use ChannelSelector to select eight channels from 16 channels. In this sample, from 0 to 7 channels are selected.

Table 14.5: 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 

16

[ch]

Number of channels for sound recording

SAMPLING_RATE

subnet_param 

16000

[Hz]

Sampling frequency

DEVICETYPE

string 

WS

 

Device type

DEVICE

string 

127.0.0.1

 

Device name

14.2.1.3 8ch sound recording with RASP24

Execute demoRASP24_8ch.n in the Record directory. After the execution, one file rec_all_0.wav and eight monaural files rec_each_0.wav, rec_each_1.wav, ..., rec_each_7.wav are generated. When replaying these files, the recorded content can be confirmed.

When recording cannot be performed well, perform the following checks.

  1. Check if the microphones are properly connected. Check if the plugs are not unplugged or loosened and connect them properly.

  2. The network connection is established with the IP address of RASP24. Check the network connection with ping.

  3. A correct IP address of RASP24 is set to AudioStreamFromMic .

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

Parameters of AudioStreamFromMic are shown in Table 14.6. RASP24 can record sound with 16 bit or 32 bit. When perform 16 bit and 32 bit recording, use RASP24-16 and RASP24-32, separately. Designate a sound recording device in this node. Designate a multi-channel sound recording device. Set 16ch to the number of sound recording channel and IP address in DEVICE. In order to execute the sample, it is necessary to change the address to that of the actual radio RASP24.

Note that a parameter GAIN is added when RASP24 is used as shown in Figure 14.5.

Table 14.6: 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 

16

[ch]

Number of sound recording channel

SAMPLING_RATE

subnet_param 

16000

[Hz]

Sampling frequency

DEVICETYPE

string 

RASP24-16

 

Device type

GAIN

string 

0dB

 

GAIN

DEVICE

string 

127.0.0.1

 

Device name

When a user set GAIN parameter, be careful about clipping.

\includegraphics[width=.4\linewidth ]{fig/recipes/demo-Record-RASP24.png}
Figure 14.5: Additional parameter for RASP24