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.


CommentiCondividi contenuti

Invia nuovo commento

Il contenuto di questo campo è privato e non verrà mostrato pubblicamente. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
  • Indirizzi web o e-mail vengono trasformati in link automaticamente
  • Elementi HTML permessi: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Linee e paragrafi vanno a capo automaticamente.

Ulteriori informazioni sulle opzioni di formattazione

CAPTCHA
Questa domanda serve a verificare che il form non venga inviato da procedure automatizzate
i
a
m
b
3
h
Enter the code without spaces.