Crossfading Notes
-
Is there a way to fade out one note and fade in another? Or is the solution to use two samplers and a script in the container to crossfade them?
-
There is a multitude of ways how you can crossfade between samples. Can you explain more details?
BTW I recently changed the internal event system from MIDI messages to a more advanced format which could be the foundation of a system to change such stuff via scripting. So if the existing possibilities do not suffice, I could introduce new features that allow this rather quickly.
-
Oh could you provide more details about the possibilities of the event system. I'm basically thinking of crossfading between sustain and legato samples but also other possibilities such as fading from different types of attack into sustain notes, and also things like crossfading rebow samples. I can think of quite a few other scenarios too.
-
Well I attached some properties to the MIDI messages that are passed around in Hise:
- event id
- ignore state
- artificial state (if the message was created with scripting)
- volume
- transpose amount (allows easier transposing so you dont have to take care about transposing the note off event to avoid stuck notes)
- pitch detune
I could add somelike like a fade event type which operate on all voices with the given event id and change either pitch or gain with a given ramp time.
But for Legato / attacl to sustain fades I came pretty far by simply adjusting the envelope times and stopping notes by adding note off messages via script…
-
That event ID with a pitch and gain adjustment for all voices would be perfect, could you also add pan adjustment in there too? I'm assuming that an event ID is created every time a note is played and relates to all voices triggered by that note event? Are the event IDs accessible outside of the samplers - can their containers see them?
With the legato I'm thinking of situations where two crossfades are required, so sustain -> legato transition -> sustain. I can do this with envelopes if I duplicate the sustain sampler but I'd rather just have one sustain sampler and one legato sampler and do the crossfading via a container's script if possible.
Fade in and fade out functions will be very helpful, would it be possible to also offer a ramp curve value so that we could do equal power fading? Or would this be better achieved using the event ID and changing the volume of the event in a loop?
-
The data structure is pretty packed right now (everything fits into 16 bytes which allows some performance boosts) so I have to be very careful which properties I'll add to it.
Changing the pan value via scripting does not seem all to relevant to me (as there are many other ways to change the pan, even on voice level). But if you have a reasonable demand for this, I'll think about it.
@13x12071:
I'm assuming that an event ID is created every time a note is played and relates to all voices triggered by that note event? Are the event IDs accessible outside of the samplers - can their containers see them?
Yes, Yes and Kind of yes.
The event IDs are created on the master level before they are passed down to each module. Whenever you create a artificial note using Synth.playNote(), it will register the event ID in the global handler (and mark it as used) so you don't end up with duplicate IDs.
When a voice is started it saves a copy of the event so you can access all properties at any time (until the voice gets killed).
But if you add a note on message in a sampler script, the container won't see it, because it would contradict the signal flow. Is there a scenario where this is a problem?
BTW I did my legato stuff with one sampler for sustains and changed the envelope attack time on each note on depending of if it is an interval or not. That worked pretty great.
But I can add fade types to the new fade event type, sure...
-
I can't think of many useful situations for changing pan on the event level so unless someone else needs it I say leave it out. I like the idea of changing the attack time on the fly to create the legato fades with a single sustains sampler, I think this will solve a lot of problems.
I'm thinking if I wanted to crossfade two notes that are in different samples via script, using the event IDs, then my script is going to have to be aware of the events created in both samplers. So can I create events in the container script and the container will then be aware of both event IDs, or can I only create events within a sampler's script?
-
This little patch shows a example usage of switching between envelope attack times:
HiseSnippet 895.3oc4Ws0aSCCE1osQvJWDf.IdLBwCcBHpYrAHPn0sxJZvtokwf2FdImtZgicvwoPAg3uH+T3e.XG2tjVBkUIXHA4o3uy4D+4yUmcD7.HIgKPVmauAw.x5719CXxds6gILz5OAYcQ6MwIRP3XfVcPLNIABQVVUepFvZtZnrmut7pXJlE.4PHz9bR.rAIhHyQecqmSnzN3PXORTAsWr05AbVaNkmp3SU6lnXbvavGAag0pUwF0m.uKAY0z9tK3Jdi2geXEW0SO2398V69f50m4519462+VY3lmUccQAoBAvj6qLGYYa8M0ik8ZgDIW3KwRP8MqsJObfeO96XlsdeRB4PJnW3g7Ubx.2gSC0Gd86n18HzvcF4BSPpu8N4NzpFG5Us2jDRNFO2wdoLAN4VTz0ZUYZzyqH8ZVJ87JgdnBrqlgcJRvCSoX43LSGYGJfvGOnuNSBrDhbPwH+eU5dY6cHxfdky2JkvWUf5OMeGF7uf8Zc6BAxbxVytyqNcizWzPkyY6SXPVwcFQtV1ZmWh6CNOEXfP6TmR48W98WducfTs66IvrjXdxXeXeHhrGmocH4fuHA5Hf2tqNHWDuMGKJUzWWti5LVpM9XYpHKaYkHdJSNV1Q0SbHoXugwKZJneIMJp8WnQwLzGy5GK8trseffDKykn41UFh9SXmQHpxBV1pXehzoOV37DnKNkJWi0Gn7Xv4wNYYktGAxiqtabiIz5Fy+ntor.sm0gy1hKgsYMlu9GqO2DJ5l.xUjRA4vTIzXRgJIpYJ2d3NRR1.NRsc5dDh9XZi4cV1YolMcdniWy4eT8OUex8raWylNtn1blTvoTPTlTcYfXJl0fkFcHHtsx4PSgQ58CYg0OYQ1QNmsiA1XHc6NBxCUjxEULipEAFpVNjJLp5mJKLojyVmQj4ZTR2n1FiNMm.U8j4s9E49mYDG8IQwTXTZzvwNSjb8qIoI66XjVet0t.EvEa8cyVanZYgEpyNLsIV+dNeSKFbcaCcczIEN+abafp+edafc4oRB6nMwp1huWcK0sRi7USgC.ESXLflnuUbEcgpYcS8ZyXXVXyQWYdnPO8ZqgB8FI7TYOhvAB9AAldR5b4ylgnN2rreQXN0+pnV63gxZkZ7MQpgmGDDnc12Q4cJ2hElYKt6LawhyrEKMyVbuY1h6OyV7foXg9lJqjJ4QlROD56.jlU3iA
And you can create events at every place and they will be processed by all child nodes so creating events in the container will do the trick.
-
Oh this is great!
-
Is it more efficient (CPU intensive) to use table envelopes for crossfading or the volume fade functions?
-
I don't know. They're both pretty cheap so I don't think this will be a bottleneck anywhere but if I have to guess I would say the scripting functions are a bit faster.