![]() |
|
sound format |
kazzmir
Member #1,786
December 2001
![]() |
I have someones music file that is encoded with adpcm. I used his decoding function to decode the data from the file( read into an array of char) into an array of shorts, but Im at a loss as to what do with that data. How can I write the decoded data to a .wav file? I cant quite tell if the music is interleaved or not, but it doesnt seem like it is right now. I think my question may be a bit vague, so if you want any extra information I can post it. |
Oscar Giner
Member #2,207
April 2002
![]() |
Quote: I cant quite tell if the music is interleaved or not, but it doesnt seem like it is right now The wave format has samples interleaved between channels. Not sure if that's your question. -- |
kazzmir
Member #1,786
December 2001
![]() |
well here is what I know so far.. The file contains a struct which has the following fields: int frequency int channels short * data but what do the channels mean if the data is one long array? Are the channels laid out in sequential order so if there are 3 channels then the first and second bytes of the song per channel would be: 0(1st) 1(1st) 2(1st) 0(2nd) 1(2nd) 2(2nd)
|
aquasync
Member #3,964
October 2003
|
If you have sox (and you probably do), you use it to convert adpcm files to normal wav files with one line. edit: |
Oscar Giner
Member #2,207
April 2002
![]() |
No, the samples are interleaved. That is, if you have a stereo wave, the data would be: 0(1st) 0(2nd) 1(1st) 1(2nd) Were the first number is a sample, not a byte. -- |
kazzmir
Member #1,786
December 2001
![]() |
aquasync: sox seems like a cool program, but it doesnt seem to be working. I havent tried to play the raw data in allegro, but I am trying this: $ sox -a -c 1 -r 22050 -w song.raw song.wav song.wav is always 90 bytes no matter what the sampling rate is and sox says sox: Overriding output size to bytes for compressed data.
the raw file is 1715934 bytes long. [edit]
[edit] |
aquasync
Member #3,964
October 2003
|
Are you trying that on the original sound file from the person, or a dump of the sample data after decoding? edit: it seems like you are trying to convert the dump ('sample.raw') with adpcm format ('sox -a'), which isn't going to work. Either try '-a' with the original file, or try the dumped data without it. |
|