NAudio Convert Byte Array to Wav

I looked at NAudio classes, but could not see a class that converts an array of bytes into a WAV file. If there is no such class, how can I convert a byte array to a WAV file using NAudio?

I want to send the text in RS232 as bytes, then I will return these bytes to the byte[] buffer. After receiving the data, I want to save it as a WAV file using NAudio.

I tried using the WaveBuffer class, but I think I'm wrong.

+4
source share
1 answer

This blog post explains how to use the WaveFileWriter class for this purpose:

 byte[] testSequence = new byte[] { 0x1, 0x2, 0xFF, 0xFE }; using (WaveFileWriter writer = new WaveFileWriter(fileName, waveFormat)) { writer.WriteData(testSequence, 0, testSequence.Length); } 
+3
source

Source: https://habr.com/ru/post/1497546/


All Articles