while NOTE_HELD puzzle

I'd like to run a loop while a note is held.
The loop has a play_note in it fed by a buffer generated on_note
if I call my loop inside on_note, the play_note loop instances for each note held, <-bad
instead of just one continuous loop while any amount of notes held. (which i want)
I can't set a var to be 1 on_note and 0 on_release because when the play_note loop happens, on_release happens stopping the loop
It seems like this loop will have to run called elsewhere whether notes are down or not? or is there another way for the ONCB to call the loop without starting multiple new instances of the loop each time?🤔
Comments
-
count held notes? start loop when count = 1, stop it when count = 0
0 -
yes where can i put the counter? if I put count = 1 on note, then i have to put count = 0 on release, but as soon as play_note happens in my loop , you get an on release. It's for a granular looping note. It works if you put the loop on note, but each on_note starts another loop process. I can just have a switch turn on the loop but then I'm stealing cycles even when no notes are playing.
0 -
maybe i could somehow make on note monophonic if I'm collecting chords in the buffer anyway
0 -
here's my crude p.o.c . I think if i can get the ORCB to check everything from a more elaborate buffer ( and build a decent buffer) it might work
{ Compiled on Thu Jul 28 16:05:43 2022 } on init declare $granflag declare $my_n_buffer declare $my_v_buffer declare $myid declare ui_button $gran_enable end on function gran_me while ($gran_enable=1) if ($granflag=1) $myid := play_note($my_n_buffer,$my_v_buffer,0,10000) end if wait(300000) end while end function on note $granflag := 1 ignore_event($EVENT_ID) $my_n_buffer := $EVENT_NOTE $my_v_buffer := $EVENT_VELOCITY end on on release if ($EVENT_ID # $myid) $granflag := 0 end if end on on ui_control($gran_enable) call gran_me end on
0
Categories
- All Categories
- 19 Welcome
- 1.5K Hangout
- 65 NI News
- 797 Tech Talks
- 4.1K Native Access
- 16.8K Komplete
- 2K Komplete General
- 4.4K Komplete Kontrol
- 5.8K Kontakt
- 1.6K Reaktor
- 386 Battery 4
- 854 Guitar Rig & FX
- 432 Massive X & Synths
- 1.3K Other Software & Hardware
- 5.8K Maschine
- 7.4K Traktor
- 7.4K Traktor Software & Hardware
- Check out everything you can do
- Create an account
- See member benefits
- Answer questions
- Ask the community
- See product news
- Connect with creators