HISE Docs

Scriptnode Voice Killer

Type ID: ScriptnodeVoiceKiller
Interface classes: VoiceResetter

A helper tool that will forward a voice-reset message from a DSP network to the HISE voice allocation system


One special task of an envelope (that is put in the gain modulation chain) is to detect when the envelope has fully decayed and then tell the voice system to stop rendering that voice (because it will be silent from now on).

The inbuilt HISE envelope modulators will monitor their signal output and tell the voice management system to stop the note (eg. when the release phase is over and the envelope is idle at zero).

If you are designing your own synthesiser using scriptnode, you can still use the HISE envelopes to kill idle voices. However there are two issues that arise from this:

  1. The end of the release phase of the gain envelope is not the only reason for stopping a voice. The most obvious other example is when you play a non-looped sample and it reaches the end of the sample. If the envelope has a sustain phase, it will cause the voices to keep playing (even if there is silence coming from after the end of the sample). Of course the HISE sound generators that are playing sample content (the Looper and the Sampler) will send a voice reset message once the end of the sample is reached, but if you're rolling your own sample player in scriptnode, you need to somehow send this information back from the scriptnode network to the HISE voice manager.
  2. If you implement the entire voice DSP inside scriptnode including the envelopes, you will also want to send out a voice reset message once the envelopes within the network finished their release phase. If you don't do this, then the voices will stack up and consume LOTs of CPU.

In order to solve these two issues, you need to add this module into the gain modulation of your scriptnode synthesiser then add one of the voice management nodes in your network to tell this module to kill the voice.

Example

Take a look at this very basic scriptnode synthesiser:

HiseSnippet 1160.3oc4X0saaTDEdV6rN0g.pUBIDbkuLUJJxtzVPhKhyO1EKvIVYCQbWzzcONdj2clkYlMIFDRHwM7Jz630f63E.Ij3EouAvY1Y2301ot1llVjvVxZmyOy4aN+Nq6IE9fRIjDmpmNJFHNa55MhqGbv.JiS5bHw4Cb6RUZPVyRZ+QwTkBBHNNkelgfS00Hoed4t6SCobeXLIB4LAyG9ZVDSOlZuleEKLrMM.NkEUP5G2riufefHTjf3oracRL0eH8B3HpQrRtDmJsBXZgzSS0fBkYeQvHuAhq3V4OioXOODLKZP7vMxRlbv.VXPu7yphPbb6M9jW1dx+P2tr.1MzG6AteJiZi0nnOvoz7fTik.RNEfzZVH8.WOeIKVOliAOumaGNFP5SQWcQnX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7pp3SVUEe5pp3mspJ94udEMuOwdIZQjcTKl22qksQsSKNEuRQ5zBx+.bjgVjB

There is a scriptnode voice killer envelope in the gain modulation and the DSP network of the synthesiser just has a single oscillator producing a sine wave generator. Note how the notes will never stop playing and stack up. This is because nothing is telling the scriptnode voice killer to do its job.

So what we need to do in the DSP network is:

  1. Add an envelope
  2. Connect that envelope to a node that sends a voice reset message

We'll pick the simple_ar and the voice_manager node, then connect the Gate output of the envelope to the voice manager (they are a match made in heaven, the gate parameter goes to zero once the release phase is done and the voice manager sends a reset message when its value is set to zero):

Now you can see that the voices are properly killed when the envelope is done. If you remove that connection from the GATE output to the voice manager, you'll see that the voices are still being silenced, but keep on rendering (watch the voice counter).

HiseSnippet 1332.3oc4X8zaaTDEeV6LN0ooPqnGfa9.GRkhhrKgBRbHNw+oXANwJaHhdJLc2wwi7tyrL6rNwfPBItvMN2abgu.8F23K.RH0uH8aP4M6t1dWuNt1VIAP3HEsyady79Mu262ad61QJrn99BIxn3IC8nHiMwlC4pd05QXbTq5Hi2A2l3qnxRQhNXnGw2mZiLLx+Ts.ihqgB+858Nf3P3VzIhPnSELK5WxbYpIR6T8KXNNMI1zSXtIzd2psrD7ZBGQ.fm73xHOhUex4zCIZ0xgQFEZXyTBoohnn9fNGHrGZ1SbAOR+SY9rm6P0CpfLgMJRLpVOlicmQmUeDx.2YxIOezI+g31La1X4S7.2ObhRSVQRefQt4AoJKAjLR.o0hfzCvlVRlmZxLZ7bWbKNDP5R.WcRnDoKx3Ov0DfBb0Ntj9zlRXv3Er0SJWd6Rv+dzm0MfaoXBdIA+PghdDeqGsw2uQwM9gMJM8Tc6Ny4zlQJbbnxYNsN5Jm2B2hG39bpb6RCHNAzwJBG+z9zBKlO0J5TmPQAuEmoNxiFOtovwV6qzOmMBfhcavSeUq5DEQGThkA54QkJlFNF0oCfr5nPTQbcpeekvCxqyD+fLGgcfCQkNcRyahm.7Gohg5.E2moFljWsD4XkmaN1hBwGf6vTV8lMFyMCLBdpaBL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ep+RAwYm56T.pPmFQU2MZvIvKCER+P+MvDbKQs

Silent Synth

Note that if you are using the silent synth generator with polyphonic hardcoded FX, then you don't need a Scriptnode Voice Killer because its functionality is already embedded into the Silent Synth! . You still need to send the voice reset messages from the network though.

Parameters

# ID Description
0 Monophonic -
1 Retrigger -