LTC timecode attached with BWF/WAV file formats

I have managed to compile the audio recording example separately and I am able to record and produce .wav and .bwf files as output.

Now, what is the way to embed LTC timecode with these recorded .wav files?
Does JUCE support this? What are my options?

Assuming you are producing stereo wav files, would you just need to add a third channel, which contains the LTC audio?

1 Like

Thanks for your response.

I have not understood your statement w.r.t third channel though as I am a newcomer w.r.t audios. I noticed there is a Midi setSmpteTimeFormat function: https://docs.juce.com/master/classMidiFile.html#ab63f442d05b8d7c2742de4515f6e8917

Do you think this can be of some use in someway?

What is your use case?

The API you refer to relates to midi data, not audio data.

1 Like

SMPTE formatted time has to be inserted in the wav/bfw file.

LTC is an encoding of SMPTE. So, please tell what would be the way to insert SMPTE time format in the output audio file.

I don’t think there’s a good enough general understanding about your request. Can you explain it in some detail - eg: what the data should look like?

It’s been some years since I’ve played with LTC, but I don’t recall that being something metadata related. From what I do remember, it’s its own data and channel.

1 Like

Jrlanglois

My understanding about this might be wrong since I am still learning about all this.
I request you tell the way you would normally implement it -as you say it has its own data and channel.

What is the way to insert this channel of smpte in an audio file which is being recorded so that the time is saved with the file?

Thank you for your patience.

Unfortunately I don’t have the knowledge to help in generating the SMPTE audio data, but maybe somebody else does… Any of us on here are able to help you add audio data to be able to write to an audio file.

For the latter, you’ll have to use an AudioFormatWriter alongside a WavAudioFormat.

There’s an example on the forums here: AudioFormatWriter ->write or ->writeFromAudioSampleBuffer .

1 Like

@cpr2323

Can you please shed some light on how to add a channel which contains LTC/SMPTE data in a wav flle?

@jrlanglois

I will read the links that you shared. Thank you for your helpful attitude.

[quote="jrlanglois]
Unfortunately I don’t have the knowledge to help in generating the SMPTE audio data, [/quote]

I am trying to make my understanding clear. So, is this correct that SMPTE is a format of time and that format of time can be added as a channel to an existing wav file?

Moreover when you said “generating smpte audio”, did you mean what this application is doing? : https://txl20.com/ltc-wav-generator/

The answer to your question does depend on what you need to do with the result. A BWAV file can have a start-timecode as part of its metadata: this is simply a count of the number of samples since midnight, and from it you can derive the correct timecode for any sample in the file, since the sample-rate is known and constant.

But that is not SMPTE LTC timecode, which is no more than a piece of audio in which the sound represents the timecode as it counts up . If you want to add that kind of timecode to an existing file, then you have to produce a copy with an extra audio-track where the code is laid-down, and ‘record’ the LTC audio to it. Producing a copy of the BWAV file with the extra track can be done using JUCE functions, but not generating the LTC audio.

There are libraries to do this (e.g. libtc), but before going down that path it would be worth being clearer about what the resultant file will be used for, because it might be possible to use the BWAV metadata instead - which is much less trouble. Is it for synch? Also, what values should go in the LTC, and where do they come from. If they start at zero, there’s no added information: so are they to be based on existing metadata start-codes? Or are they going to be set by hand?

1 Like

Slightly more complicated than that :slight_smile:

Longitudinal Timecode is a bidirectional 80 bit encoded frame synchronous encoded data (so it can be read forwards and backwards when you rock the tape - and the synch words line up with the leading edge of the digital word clock so digital systems can do a “lock and release” synchronization while still staying in sync, where an analog device uses the sync encoded to do a phase-lock-loop synchronization).

Try and find a copy of the Cipher Digital Timecode Handbook for reference.

There is a library on Github I think which encodes/decodes LTC streams.

Rail

1 Like

And also, unless you are using tape, utterly obsolete for any purpose other than a dogged insistence on using it, which is why I didn’t go into any detail. You never know, it might be possible to avoid it here, because after all, BWAV files don’t have frames or word-clocks or any other gubbins like that.

1 Like

I am thankful for the helpful attitudes of the people here. I will post here after I get more clarification on this topic.