class NatML.Recorders.WAVRecorder : IMediaRecorder
The WAVRecorder records audio to *.wav waveform files.

Creating the Recorder

/// <summary>
/// Create an WAV recorder.
/// </summary>
/// <param name="sampleRate">Audio sample rate.</param>
/// <param name="channelCount">Audio channel count.</param>
WAVRecorder (int sampleRate, int channelCount);
You will provide the audio sampleRate and channelCount in order to specify the audio format of the audio sample buffers that will be committed to the recorder.
When recording audio from Unity (e.g. using an AudioInput):
  • Set the sampleRate to AudioSettings.outputSampleRate.
  • Set the channelCount to (int)AudioSettings.speakerMode.

Committing Frames

/// <summary>
/// Commit an audio sample buffer for encoding.
/// </summary>
/// <param name="sampleBuffer">Linear PCM audio sample buffer, interleaved by channel.</param>
/// <param name="timestamp">Not used.</param>
void CommitSamples (float[] sampleBuffer, long timestamp = ...);
Refer to the Committing Audio Frames section of the IMediaRecorder interface for more information.
The WAVRecorder does not use timestamps on committed frames.
The WAVRecorder does not support committing video frames. Doing so is a null operation.

Finishing Recording

/// <summary>
/// Finish writing and return the path to the recorded media file.
/// </summary>
Task<string> FinishWriting ();
Refer to the Finishing Recording section of the IMediaRecorder interface for more information.