How to generate a wave stream outside the raw audio samples in C #? Here is a good sample project for reading and writing WAV files: Assume that your " Raw audio "is an array of low (2-byte) integers, this is a simple task that is titled 44 bytes (see note) of a WAV file, so you write the first header (using the code in the sample) after the data .
Note: Not all WAV files are "canonical", which means that they do not have 44-byte headers after all the data. The WAV format is actually a RIFF format, which means that they can contain all the different types of data and the header is not necessary at the beginning, however, there is nothing from the fact that you just write WAV files are there.
Update: If the voice recognition program is expecting a stream (as opposed to a file path), it's easy to create a memory stream Is
like this:
byte [] bytes = system IOFILE Readelbates ("c: \ whatever .wav"); System.IO.MemoryStream Stream = New System.IO.MemoryStream (bytes);
Or you can completely escape the file I / O and create your WAV file in the first place as an in-memory byte array, and in it MemoryStream < / Code>.
Comments
Post a Comment