Page 1 of 2
midi note length
Posted: Tue Mar 14, 2017 4:36 pm
by elt.net
hello, how to get the duration of currently midi note played in midi clip ? thx.
Re: midi note length
Posted: Tue Mar 14, 2017 5:33 pm
by chapelier fou
call "get_notes" on the target clip, and concurrently observe "playing_position".
Re: midi note length
Posted: Tue Mar 14, 2017 5:36 pm
by doubleUG
notein > borax
borax reports the duration at note off.
Re: midi note length
Posted: Tue Mar 14, 2017 10:15 pm
by elt.net
yep. thx.
- borax doesn't fir as I need duration at note on.
- "get_note" & "playing_position" : yes I supposed something like that but I can't achieve it. could you share the code please ?
Re: midi note length
Posted: Tue Mar 14, 2017 11:03 pm
by chapelier fou
elt.net wrote:yep. thx.
- borax doesn't fir as I need duration at note on.
- "get_note" & "playing_position" : yes I supposed something like that but I can't achieve it. could you share the code please ?
Don't have any code and no time for now, sorry !
With pleasure sometime later if there is no rush ?
Re: midi note length
Posted: Wed Mar 15, 2017 4:46 pm
by elt.net
no prob. It was just in case you had it already. thx.
Re: midi note length
Posted: Thu Mar 16, 2017 1:04 pm
by broc
chapelier fou wrote:call "get_notes" on the target clip, and concurrently observe "playing_position".
Nice idea but the timing will be problematic due to unpredictable latency of the Live API.
Just did a test with a clip note on beat 1.0 where the observer reports playing_position 0.85 (!)
Re: midi note length
Posted: Thu Mar 16, 2017 3:11 pm
by chapelier fou
broc wrote:chapelier fou wrote:call "get_notes" on the target clip, and concurrently observe "playing_position".
Nice idea but the timing will be problematic due to unpredictable latency of the Live API.
Just did a test with a clip note on beat 1.0 where the observer reports playing_position 0.85 (!)
Ah. Those latency issues are so frustrating.
Re: midi note length
Posted: Thu Mar 16, 2017 5:50 pm
by elt.net
ouch. ok I'll check it but I'm afraid it will not very useful…
Re: midi note length
Posted: Thu Mar 16, 2017 8:50 pm
by broc
Notice that the latency problem can be eliminated under certain conditions. For example, if the clip notes are strictly quantized to 8th (0.5 beats), the observer output could be quantized accordingly using [round 0.5] to ensure accurate timing.
Re: midi note length
Posted: Thu Mar 16, 2017 10:12 pm
by elt.net
yes absolutely right. but unfortunately I plan to do something not quantized at all.

Re: midi note length
Posted: Thu Mar 16, 2017 10:41 pm
by chapelier fou
Maybe tell us what you want to achieve ?
Sometimes it's good to have a different point of view, as there might be another way to do it.
Re: midi note length
Posted: Fri Mar 17, 2017 11:27 pm
by elt.net
yes for sure I'll do asap. we're a little bit busy now. thx.
Re: midi note length
Posted: Tue Mar 28, 2017 9:38 am
by elt.net
Just a tip (I didn't take time to explore yet) but it seems [borax] should do the job… no ?
Edit: ha No, duration is sent at noteoff, and I need it at noteon…
Re: midi note length
Posted: Tue Mar 28, 2017 12:08 pm
by broc
There may be a solution by giving each note a unique number:
1. Load the clip notes into a coll with index numbers, sort by start times and renumber the indices.
2. At playback count the note-on events and get the corresponding duration from coll.