omni
February 24, 2024, 5:35pm
1
I’m going to be using the writeFromAudioSampleBuffer function from the AudioFormatWriter class but I can’t figure out how to insert the sample start offset (bext samples from midnight) into the bext chunk of the header. This is used for telling the DAW and other software the “original position” of the file. Does anyone have any ideas?
Thank you in advance!
Looks like you might need to use:
https://docs.juce.com/develop/classWavAudioFormat.html#af39c0f3786cc1fea9b8c502a7e0a24f7
and
https://docs.juce.com/develop/classWavAudioFormat.html#a1f6a333b084402d486af76d518971160
I think the metadata you’re trying to change is timeReferenceSamples in that function.
Oh, you can include the metadata in the createWriter call actually.
1 Like
MarcelH
February 25, 2024, 11:52am
3
This might also clarify what needs to go there:
Section 2.4.
2 Likes
omni
February 25, 2024, 11:18pm
4
Thanks guys! @AdamVenn , this worked perfectly… awesome.
@omni , this is interesting - got some sample code for those of us following in your footsteps?
omni
February 27, 2024, 10:52am
6
Sure! Relevant code:
juce::StringPairArray metadata;
metadata.set(juce::WavAudioFormat::bwavTimeReference, juce::String(currentBufferStart));
if (auto writer = wavFormat.createWriterFor(fileStream.get(), lastKnownSampleRate, 1, bitDepth, metadata, 0))
1 Like