Skip to main content

WAV encoder

PCM (Pulse Code Modulation): The standard form of digital audio in computers and compact discs, where analog audio signals are converted into digital without compression, preserving high fidelity.

WAV encoder block can produce a PCM stream with a specified format.

Use the WAVEncoderSettings class to set the parameters.

Block info

Name: WAVEncoderBlock.

Pin directionMedia typePins count
InputPCM1
OutputPCM1

The sample pipeline

Sample code

var pipeline = new MediaBlocksPipeline();

var filename = "test.mp3";
var fileSource = new UniversalSourceBlock(await UniversalSourceSettings.CreateAsync(new Uri(filename)));

var wavEncoderBlock = new WAVEncoderBlock(new WAVEncoderSettings());
pipeline.Connect(fileSource.AudioOutput, wavEncoderBlock.Input);

var wavSinkBlock = new WAVSinkBlock(@"output.wav");
pipeline.Connect(wavEncoderBlock.Output, wavSinkBlock.Input);

await pipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.