This node saves speech waveform data in time domain as files. The difference between this and the SaveRawPCM node is only the format of the output files, that is, the wave file format has a header. Therefore, audacity or wavesurfer can easily read the output files of this node. If you want to read a waveform using the AudioStreamFromWave node, use this node instead of using the SaveRawPCM node.
No files are required.
When to use
The same as the SaveRawPCM node. This node is used when wishing to convert separated sound into waveforms in the Synthesize node to confirm the sound or when wishing to record sound from a microphone array by connecting it to the AudioStreamFromMic node.
Typical connection
The usage is almost the same as for the SaveRawPCM node. The only difference is the SAMPLING_RATE parameter. You can use this node by replacing the SaveRawPCM node with SaveWavePCM node in Fig. 6.11 and 6.12.
Parameter name |
Type |
Default value |
Unit |
Description |
BASENAME |
sep |
Prefix or format string of the file name to save. |
||
ADVANCE |
160 |
[pt] |
Shift length of the analysis frame of the speech waveform to be |
|
saved in a file. |
||||
SAMPLING_RATE |
16000 |
[Hz] |
Sampling rate. This parameter is used to set its header. |
|
BITS |
int16 |
[bit] |
Quantization bit rate of speech waveform to be saved |
|
in a file. Choose int16 or int24. |
||||
INPUT_BITS |
as_BITS |
[bit] |
Quantization bit rate of input speech waveform. |
Input
: Map<int, ObjectRef> or Matrix<float> type. The former is a structure containing a sound source ID and waveform data (such as a separated sound) and the latter is a waveform data matrix of multiple channels.
: Vector<ObjectRef> type. Sound source localization results (Vector of Source type objects) is acceptable. This input is optional.
Output
: Map<int, ObjectRef> or Matrix<float> type. The output data is the same as the input.
Parameter
: string type. It is used for formatting the file name. The default value is sep_. See the next section for details.
: int type. It is necessary to make this the same as the values of ADVANCE of other nodes.
: int type. It is necessary to make this the same as the values of SAMPLING_RATE of other nodes. This value is used only for the header and you cannot change the SAMPLING_RATE of the A/D converter.
: string type. Quantization bit rate of the speech waveform to be saved in a file. Select int16 or int24.
: string type. Quantization bit rate of input speech waveform. Select int16 or int24. as_BITS means the same value as BITS.
Format of the files saved: The files are saved as Wave PCM sound data format with header information. Therefore, when reading the files, users don’t need to specify sampling frequency, track quantity and quantization bit rate. Moreover, the written files vary depending on the types of inputs as follows.
The file written is a multichannel audio file with the same number of channels as the number of rows in the input.
The written files have filenames with an ID number after BASENAME, and monaural audio files are written for each ID.
The file name determination: This node provides two ways of file name determination.
Prefix [default]
The value of BASENAME paramseter is used as prefix. The source ID and an extention .wav is concatenated afterwards. For example, if the BASENAME is sep_ and the input source IDs are 1, 2, 3, then, the file names become sep_0.wav, sep_1.wav, sep_2.wav.
Format string [after HARK 2.3.1]
If the BASENAME contains a special pattern {tag:format}, the value is interpreted as a format string. Using this formatting, the users can set more flexible file names.
The number of acceptable values for tag is four (Table 6.7) srcid and date, meaning the source ID and the time, respectively, can be used without any limitations. However, to use azimuth and elevation for the format string, the SOURCES input of the node must be connected to utilize the sound source localization results.
The value foramt is optional. This part can be used to specify the digits, such as 03d. The expression is the same as printf.
Tag |
Description |
Unit |
srcid |
Source ID |
integer |
date |
Time when the file is sved |
String (yyyyMMDD-HHmmss) |
azimuth |
Azimuth of the localized sound (SOURCES input required) |
degree(integer rounded to the nearest decimal point) |
elevation |
Elevation of the localized sound (SOURCES input required) |
degree(integer rounded to the nearest decimal point) |
Example format strings
FORMAT: wav_id_{srcid}_output
OUTPUT: wav_id_0_output.wav, wav_id_1_output.wav, ...
FORMAT: wav_id_{srcid:03d}
OUTPUT: wav_id_000_output.wav, wav_id_001_output.wav, ...
FORMAT: wav_az_{azimuth}
OUTPUT: wav_az_30.wav, wav_az_-10.wav, ...
Note that, in this case, the file is overwrittend if two localization results have the same azimuth. To avoid this, adding srcid in the format is recommended to ensure the uniqueness of the file name.