How is the dwFraction used in a 'smpl' chunk in wav files
- KVRian
- Topic Starter
- 1253 posts since 31 Dec, 2008
Basically, I know how dwFraction is interpreted. But I don't know why there is only one fraction value. It seams to me that if there is a dwStart and dwEnd loop points, then there should be TWO dwFraction values. One for the start and another for the end.
Any ideas about this?
Any ideas about this?
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.
Advice is heavy. So don’t send it like a mountain.
- KVRAF
- 7888 posts since 12 Feb, 2006 from Helsinki, Finland
I actually would kinda like an answer to this question as well. All documentation just repeats "fraction of the sample to loop" which is about as vague as it gets (and probably copied from another document verbatim).
Given that dwEnd is apparently(?) supposed to point to the last sample of the loop (rather than the first sample following the loop as one would normally expect), the whole spec seems wonky enough that it's hard to make an educated guess.
Given that dwEnd is apparently(?) supposed to point to the last sample of the loop (rather than the first sample following the loop as one would normally expect), the whole spec seems wonky enough that it's hard to make an educated guess.
- KVRAF
- 15253 posts since 8 Mar, 2005 from Utrecht, Holland
I think the designers thought one fraction is enough to trim the loop length to the desired frequency, and a second fraction would only conplicate things.
We are the KVR collective. Resistance is futile. You will be assimilated.
My MusicCalc is served over https!!
My MusicCalc is served over https!!
- KVRAF
- 7888 posts since 12 Feb, 2006 from Helsinki, Finland
Sure, if the waveform is locally similar at both loop points, then shifting both of the points the same (small) amount in the same direction has little effect and one can snap one of the points to a full sample... but that doesn't answer the question of which point the fraction applies to?
edit: I can't seem to find any source code that actually uses the fraction, for example libsndfile just ignores it and always writes zero ..
edit2: So as far as I can tell, everyone just repeats the wording from the original spec, which only says "Allows fine-tuning for loop fractional areas between samples. Values range from 0x00000000 to 0xFFFFFFFF. A value of 0x80000000 represents 1/2 of a sample length." and just about any code I can find just ignores the field.
- KVRian
- Topic Starter
- 1253 posts since 31 Dec, 2008
The bummer is that I've already coded a sampler that cares about fractional (in between samples) loop points. Exporting this as wav would have to truncate at integral samples which may not sound the same at very highly pitched sounds. I could use dwFraction ofcourse to at least insure exact loop length but whats the use if other samplers just ignore it.
For long sample files (say 1 to 60 sec). Applying cross fades would also not work well with other samplers if the loop points weren't exact. The only way I can see it is to truncate to intergral, then cross fade.
For long sample files (say 1 to 60 sec). Applying cross fades would also not work well with other samplers if the loop points weren't exact. The only way I can see it is to truncate to intergral, then cross fade.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.
Advice is heavy. So don’t send it like a mountain.