Hello,
I want to update some values inside the SMPL chunk metadata in a wav file.
I have a wav file that is a one shot sample. It has the SMPL chunk that it is useful for information like “MidiUnityNote” or “MidiPitchFraction”. The value of “NumSampleLoops” is 0 (and it is correct since it is a one shot sample). But when “NumSampleLoops” key is 0 the SMPL chunk is not written into the wave file.
Infact inside juce_WavAudioFormat.cpp the function SMPLChunk::createFrom() skips completely all the chunk so that the resulting file does not have this chunk anymore.
It seems to me that this behaviour is not correct.
The chunk should be saved anywway with “NumSampleLoops” = 0 (as it is in the original file).
Hmm the Str3_L3_DW_67.WAV one looks corrupted. The smpl chunk length reads as 60 bytes but there are only 36 bytes left in the file… The other one looks OK.
Thanks for your support. I did a simple test and it’s working correctly now. I’ll do more tests in the next days.
I wrote to the forum because I hope to have this fix released with the next version of Juce. Do you think to commit this modification?
Thanks, looks like a sensible thing to add. (The zeromem call isn’t needed though, the MemoryBlock clears the block itself when allocating it). I’ll add a change to do this…