# WAV encoder

Media Blocks SDK .Net

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 direction Media type Pins count
Input PCM 1
Output PCM 1

# The sample pipeline

graph LR;
    UniversalSourceBlock-->WAVEncoderBlock;
    WAVEncoderBlock-->WAVSinkBlock;

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