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.