6.1.5 SaveWavePCM Outline of the node

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

No files are required. Usage

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. Input-output and property of the node

Table 6.6: Parameter list of SaveRawPCM 

Parameter name


Default value







Prefix or format string of the file name to save.





Shift length of the analysis frame of the speech waveform to be


saved in a file.





Sampling rate. This parameter is used to set its header.





Quantization bit rate of speech waveform to be saved


in a file. Choose int16 or int24.





Quantization bit rate of input speech waveform.



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



: Map<int, ObjectRef> or Matrix<float> type. The output data is the same as the input.



: 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. Details of the node

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.

Matrix<float> type

The file written is a multichannel audio file with the same number of channels as the number of rows in the input.

Map<int, ObjectRef> type

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.

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

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

    Table 6.7: Tag List





    Source ID



    Time when the file is sved

    String (yyyyMMDD-HHmmss)


    Azimuth of the localized sound (SOURCES input required)

    degree(integer rounded to the nearest decimal point)


    Elevation of the localized sound (SOURCES input required)

    degree(integer rounded to the nearest decimal point)

    Example format strings

    Insert source ID at the middle of the file name


    • FORMAT: wav_id_{srcid}_output

    • OUTPUT: wav_id_0_output.wav, wav_id_1_output.wav, ...

    Insert source ID with zero padding


    • FORMAT: wav_id_{srcid:03d}

    • OUTPUT: wav_id_000_output.wav, wav_id_001_output.wav, ...

    Insert azimuth to the filename


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