Retrigger On Release
-
A little script I've written that will retrigger a note when you release it, good for creating double/triple tongue and tremolo effects. It has a button to activate/deactivate it which can also be controlled by a selectable CC such as the sustain pedal.
Released as GPLv3.
<?xml version="1.0" encoding="UTF-8"?> <Processor Type="ScriptProcessor" ID="Retrigger On Release" Bypassed="0" Script="/** * Auto Retrigger on Release * Author: David Healey * Date: * Modified: * License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html */ //INIT Content.setHeight(50); const var velocities = Engine.createMidiList(); const var btnEnable = Content.addButton("Enable", 0, 10); const var cmbCC = Content.addComboBox("CC Trigger", 150, 10); for (i = 0; i < 128; i++) { 	cmbCC.addItem(i); } //FUNCTIONS //CALLBACKS function onNoteOn() { 	velocities.setValue(Message.getNoteNumber(), Message.getVelocity()); } function onNoteOff() { 	if (btnEnable.getValue()) 	{ 		Synth.playNote(Message.getNoteNumber(), velocities.getValue(Message.getNoteNumber())); 	} } function onController() { 	if (Message.getControllerNumber() == cmbCC.getValue()-1)	 	{ 		Message.getControllerValue() > 64 ? btnEnable.setValue(1) : btnEnable.setValue(0); 	} } function onTimer() { 	 } function onControl(number, value) { 	 } "> <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0" onNoteOnOpen="0" onNoteOffOpen="0" onControllerOpen="1" onTimerOpen="0" onControlOpen="0"/> <ChildProcessors/> <Content> <Control type="ScriptButton" id="Enable" value="0"/> <Control type="ScriptComboBox" id="CC Trigger" value="65"/> </Content> </Processor>
-
Nice. I have nothing to add about the functionality - it pretty much says what it does :) However I'd like to propose another way of posting these kind of snippets.
- Post only the script (Edit -> Save Script to clipboard) with Javascript syntax highlighting (you can use
```javascript
for the start tag to enable Javascript syntax highlighting).
/** * Auto Retrigger on Release * Author: David Healey * Date: * Modified: * License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html */ //INIT Content.setHeight(50); const var velocities = Engine.createMidiList(); const var btnEnable = Content.addButton("Enable", 0, 10); const var cmbCC = Content.addComboBox("CC Trigger", 150, 10); for (i = 0; i < 128; i++) { cmbCC.addItem(i); } //FUNCTIONS //CALLBACKS function onNoteOn() { velocities.setValue(Message.getNoteNumber(), Message.getVelocity()); } function onNoteOff() { if (btnEnable.getValue()) { Synth.playNote(Message.getNoteNumber(), velocities.getValue(Message.getNoteNumber())); } } function onController() { if (Message.getControllerNumber() == cmbCC.getValue()-1) { Message.getControllerValue() > 64 ? btnEnable.setValue(1) : btnEnable.setValue(0); } } function onTimer() { } function onControl(number, value) { }
- Then you can add an example patch as HiseSnippet that demonstrates the behaviour. This is a sine generator with an AHDSR Envelope (important because you'll get stuck notes otherwise!):
HiseSnippet 1320.3oc4XskbaaCEkzxbZDiiaxLs8aL9KIGaJI+HMiScsdXKakHaqQTws8qTHRHILgDPgDTNpcxlnqftT5RnKkrCZAHHMorYsi5zlXOgeQbu2CvAmKvEfriG0B46S8TTueuoiQJpKoYNkvF0XDDSTZsuh5xZGC8YHOfzT8oig99HaEU0bGJLnleQkvm2uWcnCjXgRLonbFEagZicwrDq+b0WfcbZBsQ8vtohdqpsrnjFTGZ.mO4zJqLFZ8Z3PzIPQXKnoLAiN2WQsr1laX385J8+kZF7mIM2n9l8di30mW2nqqQ3Smydd4VxWUrB77PD1Yb3JpZp+E+QU6.aLi5YxfLDuOWrN0dp4H54D4PeF1G22AIZTQwjyIo4lTGawjW7tRiQXG6NwRnuBuu6jHn4jB5WocL1Feg8Dg8ggN.IHRKspKbczqRZ5UNS5UIC5ojhcKJYGmDT6.GHaVlIxrQNvzYS5sHLDwGyllNy+IktORqClYMJa9tPF7kmn9+luQI+GncvfAHKVBYWTq4O9wMSurjJ2WyDSPgatCIxWG1F7CvIHvgHBxSHpWy16+7+9s2mZw3idOOHweL0elN1D4h6QIBAIw3K8QM8PuoqHIm1dCJzKSWueul74XlXLgr.uvUK0boAD1LqNx8AmRRWaX1MMohOiBEK9InPwbTGS8pa8djlokGdLKwifaeiVWDyCObH+.hSIftHGDjmISyPILkE9sbZkVcUcvpfZALJHAG8BbQNGQ81ArObB1FbDB5flJruOe9sCP7FWiwCvH6cDMZyW.R74dNrS6IaBVGLhwF6uSoRme94FCIAFTugkbjA4WZ3Xm02znrAhXLh45nuZIc8RkZcRqd5MnhBELCeD6HDd3HVgsKW7Y5570r9LvDnGXBxgZgYXjOXWvAjg7kVFVdHNuD4m1XeVgYAzmQNf.4pOO93tGZaWOfwnjBqH8sxZfxqApHFqDjVt8azXVTMnt8o0ousvJbO8jRGGaksiQqOf5AJf4nJ+L.F7cfJa7T9KO9wE0+U87g8nneZwPtEv73emXp27kmznWqSOwTznQs1sqWqwKL0GDPrDKh44lSnLzojBgcRhBHjoyfNAnBGyWLvOi1XHhIB8j.29HuBEWCjxwYRbSKTTNtWt6GLP1+3AfBWHZg.CGhhE0yy8lOr3kwXG3TAp+4QNEMGdCzTPn7u6RbRn5dTGGQ.wzJE9D2w8BX2ckorTbd8JEyKoclPihB78fmrEXujkJIBakhfcxxd4rnrnTaDa4dt5bo.IjpbsQzGwwckJc5eXUOrjKKSEHkzhfYmNFcQa45lXKkUtHUm1Thdj1Z3jIivRLkwIdQaUDmsGENOTVXoqkiJcI23of4kktmlTVUB0izmXnbYzOLBc7FvP7KokrK7R8Q0NUuUbQq+kk6WRx2uPq1Q6a1Mhlguyq4I1YMFcyzrFiwu5di.uIybp99HK3zqXUF7UszFwGtzlOhOKRZaTMr6tvvu2upYfOalKs7S+Q7IRotFxk0vbeXZ3Mbc+qKO+.M4LBDdina22ld4XtJk+a2jcIsv0.2Ez0uTKZ04cBgcYsnMN2Ej1q8C.y844G.1kFvvjgGC42x9s7JU7qpXx+vKKDmIDBxwW7iPVPbtorcYQa4WdQrKG+WRhbVQzVMxYkXmeTFCWnkG8UVxyjE0buWnE97lD9WgxqcrnMnR7ovBswkee7WYYID604pS1H1XtQr4biXq4Fw1yMhmL2H914FwSuFDhO9Q7EctxsdJJ+8GlOHe
This allows both to check out the functionality faster as well as making the code more readable in the forum - also then you don't need to specify the license since it's already in the code - DRY :)
- Post only the script (Edit -> Save Script to clipboard) with Javascript syntax highlighting (you can use