Write a wav header, in C and python
I had this raw audio stream in a file, with no header, just the encoded data, but I knew the data properties from somewhere else than the file; in order to make any media player to recognize and play the audio data I decided to rebuild a WAV header for it, that worked fine, even for a compressed audio format.
The WAVE format is quite simple if you restrict yourself to a subset of its functionalities, all I needed was a RIFF chunk, a Format chunk and a Data chunk; for the Format chunk I had to use the WAVEFORMATEX Structure because the data I had was in a compressed format and some extra data was needed to be passed to the audio decoder; this kind of data is called Private Codec Data in some context, and AFAIU in the case of WMA codecs it specifies parameters for a descrambling mechanism used for error concealment (see the Stream-specific data for audio stream part in this ASF doc from avifile.sf.net).
You can find C and python snippets for writing a WAV header in the wav_header git repository; those are there mainly for illustration purposes, but you can do whatever you want with them.
Commenti
Invia nuovo commento