Midi in File - Timecode

I’m looking to take in LTC and have that drive the progression of a midi in from a file. I’m looking to record the midi inside ableton, and then import the file, and have it triggered and played back when that specific timecode hits.

I’m not sure how to work with how to work with midi in using a file. If anyone can shed any light on how to make this work it would be much appreciated.

thanks!

Hello,
I am not sure to understand your problem. You speak about LTC (sound file “playing” timecode) and not MTC (timecode passing though midi)?
Who play the LTC file, Ableton or TD, who play the midi file, Ableton or TD.
If you want to play your midi file in TD it is for what? there is no proper synth or sampler in TD, I think its better to stay in Ableton to play the midi file.
Please give more details on your project.
Jacques

Hi childrenofthenull,

I’ve done some similar things, and unfortunately there’s no palette items that handle this type of conversion. However, here’s how you do it - the LTC Chop will get you hours, minutes, and seconds in separate channels.
Step one is to convert this to seconds (multiply minutes by 60, and multiply hours by 3600, then add those two values to the seconds value). Now you have the total number of seconds your timecode has reached.

Step two is to get the length and PPQ of your midi file. If you drop an info chop, and then drag you midi in chop onto it, you’ll get some debug information on your midi file. You’ll notice a ‘length’ parameter, however the length is NOT in seconds - this is in PPQ, or ‘Pulse Per Quarter Note’. [url]https://en.wikipedia.org/wiki/Pulses_per_quarter_note[/url] . This is how many ‘samples’ per quarter note your midi file was created at. You will need to look up what your DAW exports at, common resolutions are 24, 48, and 96, though interestingly, some DAWs like FL Studio will export at up to 980 PPQ for ultra hi res automation of CC’s. Let’s say your PPQ is 24.

Now you have enough information to scrub through your midi clip. Let’s assume you want to lock it to TD’s timeline. Drop a timeline CHOP, from which you can get the seconds of the timeline. If you know the BPM of your exported midi clip, you can now calculate how many PPQ units have passed on the touchdesigner timeline! Let’s say your bpm is X bpm. 60/X is the length of one quarter note, so the current quarter note your timeline is one is described by current_timeline_in_seconds * (60/X) . So then multiply that by the PPQ value (let’s assume 24) to get the current position on the timeline in PPQ units : current_timeline_in_seconds * (60/X) * PPQ_value .

Now, use a lookup chop, which will scan through your midi file given an input value of where to grab the input from, like a scan through a wavetable on a synthesizer if you are familiar with that analogy. Divide the previous value you calculated (current position on the timeline in PPQ units), by the length parameter from the midi file (the length in PPQ) units. This gives you a ‘normalized’ (ie 0.0 through 1.0) value of where you are in your midi clip. Feed this value into the first input of the lookup chop, and your midi file into the second input of the lookup chop. The output will be a timesliced output of the current midi notes that are playing, with the value of the channel being the velocity of the midi note! Note you can use the ‘cyclic’ parameter in the lookup CHOP to determine what happens if you go below 0.0 or above 1.0 in your lookup value - ie if your clip is 3 minutes long but your timeline is at 5 minutes, do you hold the last note, or wrap around and end up 2 minutes into your clip.

Hopefully this helps!