-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong total number of samples after encoding DSD(.dsf) file #71
Comments
Sample files: Converted with:
Expected sample length: 564480 samples |
First of all thanks for adding WavPack DSD support to music-metadata...very cool! Yeah, it's a little confusing, but DSD files look like they actually have 8-bit samples, even though they're obviously 1-bit samples. I would suggest that you take a look at the WavPack 5 Porting Guide, especially third paragraph of section 7.0 for an explanation of this. I realize that you aren't using the WavPack library APIs from Java, but this information is still probably useful because it also applies to the actual WavPack header. Specifically there was a change made to handle files with over 2^32 samples by using a previously unused byte in the header. I did this in a way that's completely compatible as long as the file isn't super big, but your code will fail if a big one comes along. So basically you'll have to multiply the number of samples by 8 if the DSD flag is set in the header. A little more complicated is the sample rate. The actual DSD sample rate is the regular sample rate stored in the flags (which I'm sure you already use) times 8 (because it's bytes, not bits) times another multiplier which is contained in the metadata block for the DSD data. You could assume this is 8 because that's the rate of the vast majority of DSD files (all SACDs), but eventually you might run into a higher rate for audiophiles. Thanks again! |
Thanks a lot for your reply David!
Okay, thanks, I understand it now. I used the file format description indeed. Would be great if small description for DSD could be added to 2.0 Block Header. Is the second factor stored in the ID_ALT_TRAILER metadata-sub-block or really inside the DSD data?
Thanks for the warning, I already got it from the documentation, so you did a great job there. From the WavPack sample I attached earlier, foobar2000 seems to be able to extract metadata:
It a bit confused here, there is no APEv2 tag header set. |
That multiplier is the first byte of the As for the compressed .dsf file, I think I know what's going on there. As you know, .dsf files have an optional ID3v2 tag in the "trailer" (which in WavPack is simply everything past the audio data). When you compress the file that trailer gets stored in the If you compress using the Thanks again! |
And yes, I will update the file format description document a little more for DSD...thanks for letting me know about that. |
No thank you David. I detect the following metadata sub-blocks: Regarding the documentation (which got my attention in an attempt to fix the above). This parts of the documentation confused me as well (caught me twice in fact, due to my bad memory):
So 5 bits. .But the following is actually included in ID enumerations:
confirmed by:
So the optional flag is clearly part of the enum, while the large large block flag is not. To make this more explicit, I suggest to describe the function_id with a 0x3f mask (6-bits). In addition to that, you can still descrive 0x20 of the function_id describes the optional character (or greater than 0x1F). I will look into the decoding the compressed original ID3v2 header later. It really puzzled me where it came from. The boys and girls of Foobar2000 did a great job apparently! ;-) |
There's a simple command-line program in the
So, the DSD blocks are definitely in there. Not sure why your parsing would miss them (maybe the odd size?), but you should be able to compare this output to yours. Note that I am obviously not taking the value into account in this program (yet) which is why it shows a length of 0.80 seconds instead of 0.10 seconds. Yeah, I totally agree that the ID mask should be |
Thanks a lot for all you help David! DSD support, including DSD support for WavPack, has been added and released in version music-metadata v3.6.0. |
Cool, glad to help, thanks again for including WavPack DSD support in your code! |
Hi David. I am enhancing the DSD support in music-metadata.
I converted one of my .dff sample file into a WavPack file using wavpack.exe (wavpack-5.1.0-x64).
I noticed that the total_samples of the WavPack-block-header contains the sample length 8 times lower then what it should be (in bytes?).
Related issues:
The text was updated successfully, but these errors were encountered: