suck notes with keyassigner script in silent synth
-
@Morphoice Is this part of a secondary MIDI processor (not your UI script)?
Do you need to manually track which keys are held down? Doesn't
Synth.isKeyDown()do the job?A few notes that probably won't solve the problem:
@Morphoice said in suck notes with keyassigner script in silent synth:
global ControlValue = {};
Avoid globals - I haven't found a single instance where they are the best way to do something yet.
@Morphoice said in suck notes with keyassigner script in silent synth:
reg midiList = Engine.createMidiList();
keysdown could probably also be a MIDI list. Midi lists should be
const.
midilist isn't a good name for a variable because midilist is a data type. It's like calling an array array, it's confusing.@Morphoice said in suck notes with keyassigner script in silent synth:
reg i = 0;
What's this guy for?
-
@David-Healey yes, KeyAssigner.js as a separate ScriptProcessor in the SynthesizerContainer which holds two silent synths. its in the container tho, not the silentsynths.
global ControlValue = {}; is dead code from an earlier iteration.
keysdown is i believe also never used and from an earlier iteration, i should eremove those
reg i is leftover from the commented-out for (i in Event.noteIds...) block -
@Morphoice Ok cool, you don't need to declare iterator variables like
i, HISE creates them in place behind the scenes automatically.Are you able to recreate the issue with a minimal example, preferably without the scriptnode elements and post it as a snippet?
-
@David-Healey it would take significant time to douplicate the project and strip it down to the essentials in question, also about everything that makes a noise is a hardcoded faust
before i do that a closer observation:
if i press the pedal and hit a note, it is not sustained, if i hit it again it is sustained. ntextr ty not sustained on the first hit, sustained on the third hit. pedal kept pressed between hits... does this help narrow it down?
i am not sure but it might have to do with multiple instances of the same note... but just a hunch.
-
@Morphoice Without having something in front of me to play with it's all just guessing. The problem could be in the script you've shown, some other script, in the networks, or in HISE. Very difficult to say.
Bypass all your scriptnode sound generates and use a waveform generator instead. If the problem still occurs then you've ruled out the issue being in scriptnode.
-
@David-Healey i thinned the project down and stripped all the effects, gui etc... which changed nothing but the waveform generator inside the synth container words fine and doesnt show the error. ... so it must be in the way either a silentsynth behaves or the faust implementation. faust just passes the midi to the parameters gate, gain, velocity, frequency etc... im not doing anything weird with it...
-
@David-Healey if the snippet correctly carries the faust code this should be a minimal example displaying the problem
HiseSnippet 3297.3oc6azza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B2jG2pie478DLXBAlVkomiaA3e2Imk0+A.ejyFa -
@David-Healey my guess is on something along the path from hise to faust or faust itself
so i pointed claude to it which revealed the following, which might be the cause and is beyond my reachFaustUI.h:201 — each Faust voice has its own MidiZones struct containing a sustain flag:
struct MidiZones { float* zones[(int)HardcodedMidiZones::numHardcodedMidiZones]; bool sustain = false; // <-- per-voice, defaults to false };PolyData<MidiZones, NumVoices> midiZones;
FaustUI.h:357-365 — the reset() method only zeros the pointer array, never resets sustain:void reset() { // ... clears modoutputs, parameters for (auto& mz : midiZones) mz.reset(); // ← only memsets zones[] to 0 anyMidiZonesActive = false; }The struct's mz.reset() is:
void reset() { memset(zones, 0, sizeof(float*) * ...); // does not touch sustain }FaustUI.h:330-338 — note-off behavior:
else if(e.isNoteOff()) { auto& mz = midiZones.get(); if(!mz.sustain) // ← only releases if THIS voice's sustain flag is false if (auto gatePtr = mz.zones[(int)HardcodedMidiZones::Gate]) *gatePtr = 0.0f; }The mechanism: mz.sustain is set ONLY by the CC 64 handler (FaustUI.h:339-356) — never on voice start, never on reset. So a voice that was allocated AFTER the pedal CC came in, OR whose voice slot has never received a CC 64 during its lifetime, has mz.sustain == false — its gate gets dropped to 0 on note-off regardless of what the JUCE voice manager thinks about the pedal.
This is independent of JUCE's voice-level sustain handling. The HISE voice manager keeps the voice ALIVE (because JUCE's sustainPedalDown is true), but the Faust envelope's gate has already gone to 0 — so the voice produces silence (release tail) and gets killed by silent_killer.
-
@Morphoice If it's on the faust side I won't be much help.
I'm not hearing any audio with your snippet.
On the script side this looks weird. What's the intention?
global Event = {}; Event.noteIds = []; Event.noteIds.reserve(128); for (i = 0; i<128; i++) { Event.noteIds[i] = []; Event.noteIds[i].reserve(32); } -
@David-Healey dead code
is there a faust node in the polyphonic scriptfx?
toes it have a dsp code?
if not put this
// Faust Source File: Test // Created with HISE on 2026-05-15 import("stdfaust.lib"); gate = button("[20]gate"); // note on off freq = hslider("[21]freq", 200, 20, 20000, 0.1); // note frequeny gain = hslider("[22]gain", 0.0, 0.0, 1.0, 0.01); // note velocity attack = hslider("AttackTime[style:knob]",0.2,0,6,0.001); attackSlope = hslider("AttackSlope[style:knob]",0.7,0,1,0.001); decay = hslider("DecayTime[style:knob]",0.3,0,6,0.001); decaySlope = hslider("DecaySlope[style:knob]",0.3,0,1,0.001); sustain = vslider("SustainLevel[style:knob]",0.5,0,1,0.001); release = vslider("ReleaseTime[style:knob]",1,0,6,0.001); releaseSlope = vslider("ReleaseSlope[style:knob]",0.3,0,1,0.001); velDepth = vslider("velDepth[style:knob]",1,0,1,0.001); legato = vslider("Legato[style:knob]",0,0,1,0.001); ramp = en.adsr(0, release * 0.15, 0, 0, 1 - gate); dramp = en.adsr(attack, decay * 0.1, 1,0, gate); rslope = releaseSlope - ramp * 0.25; dslope = decaySlope - dramp * 0.20; velocity = 1*(1-velDepth*((1-gain))); envelope = en.adsr_bias(attack, decay, sustain, release, attackSlope, dslope, rslope, legato, gate) : hbargraph("CV",0,1); osc = os.polyblep_triangle(freq) * envelope; process = osc,osc; -
@Morphoice Oh hang on, my current build doesn't include FAUST
I can't rebuild at the moment because I'm in the middle of something, but I think you've nailed down that it's a faust side issue. -
@David-Healey oh yes, the pleasures of building with faust and ending up without faust .... ;)))
im very strongly convinced the issues is within how hise implements faust as explained in the post before, not the faust dsp itself. then again that would only explains the issue that notes are not sustained even though the pedal is pressed...
the other problems are the orphan notes that might still be a problem of the keyassigner... some never get released when the pedal is released.... could be some sort of orphans from a tretrigger of the same note...
my forte is coding dsp, all that stuff around that makes the world tick -- no clue
-
@Morphoice Tell me what the key assigners role is.
-
@David-Healey handle polyphonic aftertouch and pitchbend by sending their values to a knob in the faust (not present in the snippet example)
-
@Morphoice Does that need to be scripted? Isn't there a way directly in scriptnode to get those values and forward them to the faust node?
-
@David-Healey nope, we had this discussion here a long time ago and this was the only working way
-
@David-Healey i believe it was this thread
https://forum.hise.audio/topic/11793/polyphonic-aftertouch/34?_=1778856642370 -
@David-Healey there's also another bug in the hise/faust midi implementation.... if a key is held and the pedal released, the note stops. although the key is still held.... weird.
-
@Morphoice Does this happen if you swap your faust synth for a waveform gen, keeping everything else the same?
-
@David-Healey there is no waveform generator in a silent synth