Quantisation in tracktion

I am trying to figure out how to manage quantization in tracktion. It seems that MidiClips have a QuantizationType, but I can’t figure out how it is supposed to be used.

Hi, have a look at te::TimecodeSnapType. It contains a lot of handy functions for rounding your positions to a certain beat postion. I get my snap type by:

te::TimecodeSnapType snapType = edit.getTimecodeFormat().getBestSnapType(edit.tempoSequence.getTempoAt(pos), timeDurationOnScreen / screenWidth, isTriplet);

With this snapType you can easily calculate your snapping points. If your want to snap to a certain position e.g. next bar or next tick you can generate a snapType by:

auto snapType = TimecodeSnapType(TimecodeType::barsBeats, Level);

here is a cheatsheet for the levels:

SnapTypeNumber 0 : 1 tick
SnapTypeNumber 1 : 2 ticks
SnapTypeNumber 2 : 5 ticks
SnapTypeNumber 3 : 1/64 beat
SnapTypeNumber 4 : 1/32 beat 
SnapTypeNumber 5 : 1/16 beat 
SnapTypeNumber 6 : 1/8 beat  
SnapTypeNumber 7 : 1/4 beat  
SnapTypeNumber 8 : 1/2 beat  
SnapTypeNumber 9 : Beat      
SnapTypeNumber 10 : Bar      
SnapTypeNumber 11 : 2 bars   
SnapTypeNumber 12 : 4 bars   
SnapTypeNumber 13 : 8 bars   
SnapTypeNumber 14 : 16 bars  
SnapTypeNumber 15 : 64 bars
SnapTypeNumber 16 : 128 bars
SnapTypeNumber 17 : 256 bars
SnapTypeNumber 18 : 1024 bars

I hope this helps.

3 Likes

Yes, you can see the quantisation type strings in the QuantisationTypeInfo array in the cpp file. So you’d do something like this:

QuantisationType newQuantisation;
newQuantisation.setType ("1/16 beat");
midiClip.setQuantisation (newQuantisation);
1 Like