I’m currently looking for a way to explicitly stop a note via the API while it’s being played from a pattern by an instrument. In the piano roll, you can remove notes while playback is running. But if you remove notes from the pattern that are playing and haven’t reached their note-off yet, they just keep playing forever.
Right now it doesn’t seem like there’s a way to stop a specific note directly via the API, is there? I’ve thought about just spamming note-offs into the column and then removing them again, but that doesn’t feel like a clean solution. Seems like this is something the API would need to be extended for, right?
I assume the same thing happens in Renoise itself. If a note is playing and you delete its associated note-off, the note will continue to play. The only way to turn it off is to force a note-off at the moment of deletion while playback is on the current line if follow player mode is enabled. I assume this is what you mean, and I don’t see it as practical either.
If Renoise doesn’t have a way to address this, then the API probably won’t either. How do you tell the system internally to mute the sound when you delete a note? That would be the simple case. What about multiple notes?
I think the easiest solution would be if we could just actively send a Note Off event to an instrument in the context of the affected track and column. I already tried sending a Note Off event to the instrument as part of the note deletion function, but it somehow doesn’t get recognized or is just ignored.
Edit:
renoise.song():trigger_instrument_note_off could be a solution, but the function only stops notes that were previously played with renoise.song():trigger_instrument_note_on.
Edit 2:
Looks like I found a workaround. We just need to send a NoteOn with a velocity of 0. I’m just not sure if all VSTis and Renoise instruments can handle that.
I did a bit of testing. It actually works pretty well for plugins, since the MIDI spec allows sending Note Off with Note On events at velocity 0. Unfortunately, Renoise instruments don’t react to that. Here we’d need trigger_instrument_note_off to allow stopping any note.
Even better would be if we could fire Note On and Note Off events in the context of the track and column. That way, we could implement something like MIDI Chase as well.