multi-callback ScriptProcessor portamento script (combined Delta Time + Velocity glide)
-
Hi everyone,
I’m working on a custom portamento / legato engine inside a ScriptProcessor in HISE (version 4.1.0, commit a8bcc642). I need to implement a combined portamento behavior similar to SWAM / Oriental Solo engines:
• Glide time depends on Delta-Time between two legato notes
• Glide time also depends on note velocity
• When the last pressed note is released, it performs a backward glide to the previously held note
• Everything must run in multi-callback mode (separate tabs: onInit, onNoteOn, onNoteOff, etc.)The issue is not with the logic itself, but with getting the code to work correctly as a multi-callback ScriptProcessor. Whenever I test or import my script, HISE expects the callbacks to be split across tabs, but my code becomes merged or creates syntax errors like:
Cannot assign to this expression
const var declaration must be on global level
Unexpected token after '}'I understand the following:
• const and var must be defined at global level (Interface tab)
• reg variables may be used inside onInit
• In multi-callback mode, callbacks must not contain nested function onNoteOn() declarations
• Clipboard export merges all callbacks into one block, which does not work for multi-callback mode
• HISE 4.1.0 does not support “Paste Snippet”; it only supports Import Snippet (.xml)What I am requesting
Could someone please create a working HISE Snippet (.xml) that contains a ScriptProcessor with full multi-callback structure:
• onInit
• onNoteOn
• onNoteOff
• onController
• onControl
• onTimer…and implements the following portamento logic:
-
Delta-Time Glide
Glide time is mapped from the time difference between two legato-played notes. -
Velocity Glide
Higher velocity → faster glide
Lower velocity → slower glide -
Combined Glide
Final glide time = average between Δt-based glide and velocity-based glide. -
Backward Glide on NoteOff
When releasing the last played note, it should automatically glide back to the previously held note. -
Legato note list
Notes are tracked using a simple array:
playlister.push({ noteNum, noteID }) -
Uses
• Synth.addPitchFade
• Message.makeArtificial()
• safe noteOff handling
Why I need it
I need a clean, importable .xml snippet that I can load via:
File → Import Snippet…
so I can continue building my instrument without structural callback conflicts.At the moment I keep running into callback-level and global-level variable issues, so a proper template snippet would help a lot.
Help needed
If anyone familiar with HISE scripting architecture can assemble a clean multi-callback ScriptProcessor snippet that contains:
• correct global variable placement
• correct inline helper functions
• correct callback structure
• the combined portamento behavior described above…I would greatly appreciate it.
Thanks in advance!
-
-
@keysounds if you're pasting a script in to the editor use the load script from clipboard option in the right click context menu. This will put the callbacks in the correct place.
-
@d-healey thank you, I learned that from your videos, and it's really very helpful. If somebody have and want to share one json File for this purpose can be also helpful for others at Forum. Portamento(Glide) with velocity and depend on how quick we playing the second Legato Note, something Like on SWAM Instruments.
-
@keysounds SWAM instruments use physical models, they are very complicated.
-
@d-healey I know that’s SWAM uses Physical Modelling
I have two Library's from SWAM (Clarinets and Saxes) which are Hybrids Physical Modelling and Samples, but this type of Portamento controlled over Velocity and Time is possible also with Samples and in Hise. Its a Midi manipulation.
Also is working in some Yamaha Arrangers like in PSR A-5000/Genos 2
with Samples, they are calling Crossfade Portamento there.What is Crossfade Portamento?
Portamento is a musical technique that creates a smooth, continuous glide in pitch between two consecutive notes, instead of a sudden step. It's often used for expressive, fluid transitions, especially with synth or string sounds.
The Crossfade Portamento on the PSR-A5000 enhances this by providing a silky smooth transition between the notes you play. It's particularly significant in the PSR-A5000 as it's designed to give a more natural and realistic behavior to many of its instrument voices, especially the Oriental/Middle Eastern ones like the Nay (flute) or Oud, simulating the expressive slides common on those instruments.
️ Key Functionality and Control
The PSR-A5000's implementation of Crossfade Portamento includes new parameters for greater control:
• Velocity-related parameters: The feature is sensitive to the velocity (how hard you press) of the subsequent note. This allows the transition speed and character to be modified dynamically by your playing touch, adding a layer of expression and realism.
• Time-related parameters: You can adjust and fine-tune the Portamento Time to control the overall speed of the pitch glide.
• Interval sensitivity (Optional): Traditional Portamento can be affected by the musical interval between the notes. The PSR-A5000 often allows you to switch between a mode where the transition time varies with the interval and a Fixed Time mode where the transition time is the same regardless of the interval size, offering versatility.
In essence, Crossfade Portamento works by smoothly fading the pitch of the first note into the pitch of the next, making the transitions between successive notes more expressive and fluid. -
@keysounds please don't post walls of AI text. What you're asking for is not trivial. It's unlikely someone is going to write such a complex script and post it here.
-
@d-healey OK, my apologies I will not more put AI genereted Text. I was 1 Year owner of Yamaha PSR A-5000.
-
@keysounds said in multi-callback ScriptProcessor portamento script (combined Delta Time + Velocity glide):
I’m working on a custom portamento / legato engine inside a ScriptProcessor in HISE
You started your original post with this. Does that mean you've already started writing your own script to do this task?
-
@d-healey I do some modifications on one existing script, SynthGlide, which is as Snippet in Hise Doc…