The Missing Piece of the HISE VI Puzzle: Continuous Per-Event Modulation
-
@aaronventure yes so I would just replicate this system in C++ and add accessor nodes in scriptnode. It‘s not super trivial because of the cross DLL boundary when using compiled networks but I can see the benefit.
Having a floating tile that visualizes the values would be good to for debugging.
But why do you need to clear it? You can just set it to zero manually if you need so, no?
-
@Christoph-Hart Here's one example how I use this right now.
I have script voice start pitch modulators in multiple samplers, and each has its own little logic for setting the correct pitch. Now, I can't do this from the MIDI script itself because the pitch will differ for each event. So it reads from the MessageCustom data object to perform its logic.
All events eventually pass through that pitch modulator. Some might not to have their pitch set by that specific modulator. So I use some of the slots to either flag them or do a simple ifDefined check for the slot inside the pitch modulator itself.
Eventually, the data object will get filled because the event counter will overrun it and the modulo means it'll just overwrite the old array indexes.
But the data in there will stay unless I clear it. So if a new ID is not not the one I want for a specific pitch modulator to play, it either needs to read undefined or it needs to read the value 0, which needs to be set.
So for each event, I can either set all 16 slots, or clear all slots and set only the ones I'm using (so far 10 is max but usually a lot less).
-
But the data in there will stay unless I clear it. So if a new ID is not not the one I want for a specific pitch modulator to play, it either needs to read undefined or it needs to read the value 0,
Yes, but why don't you write the zero for the events that shouldn't apply any pitch? This would be your responsibility with the new system then too and taken off that burden feels like adding Garbage Collection.
-
@Christoph-Hart Since the data object is an array, I found it easier to call MessageCustom.clearForId(eventid) than setting 0 for all the slots I don't use.
Fewer lines of code, cleaner overall.
-
@aaronventure actually I could add another data member to the array element that holds the actual event ID (and not the truncated modulo index), then you can check for equality and return undefined (or zero) without the collision at the wrap around. The performance overhead is neglible.
-
@Christoph-Hart i'm failing to understand the technicality of what you're suggesting; are you saying that clearing wouldn't be necessary as a new ID couldn't read the data that was set for the old ID?
-
@aaronventure yes exactly.
-
@Christoph-Hart perfect
-
@aaronventure Alright, I've written a few tools with this concept:
- a
GlobalRoutingManager.setEventData(eventId, slotIndex, value)
API method where you can set up to 16 double values per event ID and - get them with
GlobalRoutingManager.getEventData(eventId, slotIndex)
(if the data hasn't been set yet it will return undefined.
This basically replicates our existing Javascript helper class but in C++ and globally accessible through the global routing manager. But then it gets interesting:
- a voice start modulator that will query the given data slot and resort to a default value if not set (so you don't need to use the script voice start modulator for just passing on that value to whatever target anymore).
- a
routing.event_data_reader
node that will polyphonically read the event data and send it as scriptnode modulation connection. There are two modes available, one only reads and sends the value when the node processes the incoming note on message (to replicate voice start modulation like behaviour) and the other one listens for changes from the last event ID and outputs a time-varying modulation signal. - a
routing.event_data_writer
node that will write an incoming value into the data slot. This is polyphonic and timevarying, so you can basically send the envelope output from one scriptnode envelope to another (or create the data however you like). The update rate is tied to the buffer size though (because that's how the modules are processed one after another).
I'll clean it up a bit tomorrow and write some docs, but it looks promising.
- a
-
@Christoph-Hart said in The Missing Piece of the HISE VI Puzzle: Continuous Per-Event Modulation:
The update rate is tied to the buffer size though (because that's how the modules are processed one after another).
What does this mean for wrapping stuff up in frame/block nodes? Will it just shout about rate mismatch like the midi node when you try to place it within a block node?
-
@aaronventure no, the update rate is simply the buffer size as this is the rate that the sound generators are able to talk with each other.
-
@Christoph-Hart so on higher buffer sizes, you get lower resolution streams?
Alright, it's then important to highlight it, as this warrants like 20ms smoothing at the lowest for consistency. Can the read nodes have smoothing built in? it'll be necessary anyway, this would just make it less of a mess.
-
You can use Engine.setMaximumBufferSize() to limit the buffer length to 64 or something then you get a guaranteed update rate of 1,5ms if that‘s what you need.
The nodes will not have any smoothing as you can simply add a smoothed parameter node, but the event data envelope (which is a polyphonic HISE envelope that automatically reads out the values from the given slot will have a smoothing parameter (like the LFO).
-
@Christoph-Hart Ah, good to know, I didn't know I can hard limit the buffer size for the plugin.
Yes, smoothing parameter/control is what I meant. Hiding smoothing inside the actual readout would be naughty.
-
@aaronventure Alright, the feature is pushed now (alongside with the documentation for each thing).
I've also added a bunch of snippets to the browser that demonstrate various use cases (Custom Data Event 101/102/103).
Let me know if you find some quirks.
-
Does that solve this request? https://forum.hise.audio/topic/9501/message-event-flags-or-meta-data?_=1716378593963
-
@d-healey yup. You can now write 16 number values to a slot using an event ID and pick it up later either using scripting, a new modulator or nodes in scriptnode.
-
@Christoph-Hart Cool, have the docs been pushed?
-
@d-healey It also solves Per-event routing: https://forum.hise.audio/topic/9625/per-event-routing?_=1716386003580
-
This is still broken because 0 cannot be sent:
-