Tagging notes
-
is there a way to "tag" a note with data (like there is in Kontakt) so I can interogate it later.
Yes I know there's isArtificial() but I wanted something where I could add a value (or set of values) to a note to track which key-trigger note created it...
-
@Lindon Can't you use an object for this?
-
@d-healey said in Tagging notes:
@Lindon Can't you use an object for this?
in what way? - Im doing this:
for(n = 0; n< 5; n++) { nid = Synth.addNoteOn(1, ChordPlayer.chordPadArray[pos].data.chord[n], Message.getVelocity(), ChordPlayer.chordPadArray[pos].data.strumLength * n); ChordPlayer.playingEvents[pos].push(nid); }
So this generates a strum....by delaying each note creation by a fixed amount, but....
If the note off event happens before the strum is complete I get hanging notes...
So to be clear this strum could be any set of notes, and the note off has no idea if the note is part of the strum or not, and doesnt know what the trigger note was...
-
@Lindon For my guitar engine I'm just using the standard
Synth.playNote()
within a timer. I store the note IDs in a 6 element array (one per string)I only allow one note per guitar string, so if a second note is triggered on the same string I turn off the old one.
When the key is released I turn off all strummed notes.
-
@d-healey said in Tagging notes:
@Lindon For my guitar engine I'm just using the standard
Synth.playNote()
within a timer. I store the note IDs in a 6 element array (one per string)I only allow one note per guitar string, so if a second note is triggered on the same string I turn off the old one.
When the key is released I turn off all strummed notes.
Sounds good - for you. Im doing a chord player - with 12 trigger notes, each trigger has a chord assigned, each trigger can strum the chord - so there may well be a lot of notes passing downstream - all I want to do is attach the trigger value to each note - then later I can ignore it if the trigger note is no longer held.
So with your solution I'd need 12 timers... very very messy.
It's annoying because this is trivially simple in KSP...
-
So with your solution I'd need 12 timers... very very messy.
You make a script that takes a trigger note and generates a strum. You insert 12 instances of that script and set each one to use a different trigger note.
-
@d-healey actually I thin k I have a solution - just do the same thing in reverse using Synth.addNoteOff
for (n=0; n < ChordPlayer.playingEvents[pos].length; n++) { Synth.addNoteOff(1, ChordPlayer.chordPadArray[pos].data.chord[n], ChordPlayer.chordPadArray[pos].data.strumLength * n); ChordPlayer.playingEvents[pos][n] = -1; };