Skip to main content
Topic: WavPack - how to access data behind wvpk chunk? (Read 4421 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WavPack - how to access data behind wvpk chunk?

Hi all,

I'm currently upgrading my program 'CueListTool' - see http://www.stefanbion.de/cueltool/index_e.htm .

Now I'd like to implement support for .wv files, i.e. I'm interested in the 'extra information' (cues) at the end of the file.

I looked at the WavPack source code, and also examined a .wv file using a hex editor, but found no easy way to set the file pointer behind wvpk chunk, since there's apparently no chunk size in the file header that would allow to jump directly behind the compressed WAV data. Am I missing something...?

Thanks,

Stefan

WavPack - how to access data behind wvpk chunk?

Reply #1
Quote
The WavPack format is the first 44 bytes of the original WAV (up to the "data" chunk header), then the WavPack header itself, and finally the compressed data.

If there are any additional RIFF chunks beyond the audio data, WavPack will write 16 bytes (128 bits) of 0xff after the WavPack compressed data and then copy the rest of the RIFF header. The 16 bytes of 0xff are there to differentiate between additional RIFF data and ID tags (which we would ignore during unpacking).

The normal RIFF header which is at the beginning of the file shows the original size of both the data chunk and the entire RIFF. If you subtract the size specified for the data chunk from the size specified for the RIFF, then subtract the standard 44 bytes of the RIFF header, you then have how many bytes of extra info is after the wvpk chunk. Assuming the file isn't truncated, of course, otherwise you're in trouble

WavPack - how to access data behind wvpk chunk?

Reply #2
Keep in mind a new version of WavPack is about to be released (it's already in alpha state). Maybe it would be worth waiting a couple of months and add support for WavPack 4.0 instead of 3.x?

WavPack 4 will be much better than 3.x in several aspects.

WavPack - how to access data behind wvpk chunk?

Reply #3
getID3():

Thanks - that's it! So the extra info is at: File Size - Riff Chunk Size + Data Chunk Size + 44 - 8, right?

rjamorim:

If WavPack 4 still creates a standard a RIFF file, it shouldn't matter what's inside the wvpk chunk. I'm only interested in the cue data.

Stefan

WavPack - how to access data behind wvpk chunk?

Reply #4
Hi,

I descovered a problem with some WavPack files: If the size of the compressed data is an odd number, the "cue" chunk which follows the "wvpk" chunk can't be found by the Windows API function mmioDescend().

In the WAVE Specifications (http://www.tsp.ece.mcgill.ca/MMSP/Documents/AudioFormats/WAVE/WAVE.html) you can read that a pad byte is appended to the "data" chunk if the size of the wave data block is odd. In WavPack files, this pad byte seems to be missing, and I think that this is the reason why mmioDescend() doesn't work in this case.

Do I really have to write my own mmio functions...?

Stefan

WavPack - how to access data behind wvpk chunk?

Reply #5
Ah, the WavPack-doesn't-pad-to-WORD-bounaries bug has bitten you 

It's a problem I encountered myself, but since I don't use any prebuilt functions I can easily code around it. Good luck

WavPack - how to access data behind wvpk chunk?

Reply #6
Ok, now I have my own code too, and one more sleepless night behind me... 

 
SimplePortal 1.0.0 RC1 © 2008-2019