Round Robin + Humaniser + Velocity Curve Master Control
-
This is a kind of master front panel control for use with my round robin and humaniser scripts. If you have more than one RR or humaniser script present and you want to give the user an interface to control all of those script in one go then use this. It will look through the instrument for all script processors with round robin or humanise in their name and forward the values of the controls to those scripts. I've also added a table for editing the velocity curve which is applied in the on note callback. This script is probably best placed in the master container. Feel free to edit this to meet your needs.
<?xml version="1.0" encoding="UTF-8"?> <Processor Type="ScriptProcessor" ID="Settings" Bypassed="0" Script="/** * Round Robin + Humaniser + Velocity Curve Master Control * Author: David Healey * Date: 11/01/2017 * Modified: * License: GPLv3 - https://www.gnu.org/licenses/gpl-3.0.en.html */ //Includes //Init Content.makeFrontInterface(650, 200); const var scriptProcessors = Synth.getIdList("Script Processor"); const var rrProcessors = []; const var humaniserProcessors = []; const var ccNumbers = []; for (i = 0; i < 129; i++) { 	ccNumbers[i] = i; } for (scriptProcessor in scriptProcessors) { 	if (Engine.matchesRegex(scriptProcessor, "(?=.*ound)(?=.*obin)")) rrProcessors.push(Synth.getMidiProcessor(scriptProcessor)); //Array of RR processors 	if (Engine.matchesRegex(scriptProcessor, "(umanise|umanize)")) humaniserProcessors.push(Synth.getMidiProcessor(scriptProcessor)); //Array of humaniser processors } //GUI //VELOCITY CURVE TABLE const var tblVel = Content.addTable("tblVel", 600, 100); tblVel.set("width", 200); tblVel.set("height", 90); //ROUND ROBIN //RR Type and Mode Combo Boxes const var cmbType = Content.addComboBox("Type", 0, 10); cmbType.set("items", ["Off", "Real", "Synthetic", "Hybrid"].join("\n")); const var cmbMode = Content.addComboBox("Mode", 150, 10); cmbMode.set("items", ["Cycle", "Random", "Random No Repeat", "Random Full Cycle"].join("\n")); //Reset timeout knob const var knbReset = Content.addKnob("Reset Time", 300, 0); knbReset.setRange(0, 60, 1); //HUMANISER const var knbNoteOn = Content.addKnob("Note On", 0, 50); knbNoteOn.setRange(0, 100, 0.1); knbNoteOn.set("suffix", "ms"); knbNoteOn.set("tooltip", "Note On: adds random delay (0 ms - 100 ms) to the Note On of each note."); const var knbNoteOff = Content.addKnob("Note Off", 150, 50); knbNoteOff.setRange(0, 100, 0.1); knbNoteOff.set("suffix", "ms"); knbNoteOff.set("tooltip", "Note Off: adds random delay (0 ms - 100 ms) to the Note Off of each note."); const var knbVelocity = Content.addKnob("Velocity", 300, 50); knbVelocity.setRange(0, 100, 1); knbVelocity.set("suffix", "%"); knbVelocity.set("tooltip", "Velocity: adds or subtracts random value in selected +-range of played velocity."); const var knbFineTune = Content.addKnob("FineTuning", 450, 50); knbFineTune.setRange(0, 100, 1); knbFineTune.set("tooltip", "Fine Tuning: detunes each note randomly in the selected +-range - up to 1 semi-tone."); const var knbVolume = Content.addKnob("Volume", 600, 50); knbVolume.setRange(0, 8, 0.1); knbVolume.set("suffix", "dB"); knbVolume.set("tooltip", "Volume: changes the volume of each note randomly from -8db to +8 db."); const var cmbCC1 = Content.addComboBox("CC 1", 0, 110); cmbCC1.set("items", ccNumbers.join("\n")); cmbCC1.set("text", "First CC"); cmbCC1.set("tooltip", "First CC Number: Select a CC number to humaniser."); const var knbCC1 = Content.addKnob("First CC", 150, 100); knbCC1.setRange(0, 100, 1); knbCC1.set("suffix", "%"); knbCC1.set("tooltip", "First CC: adjusts the CC value by a random percentage in the +-range selected."); const var cmbCC2 = Content.addComboBox("CC 2", 300, 110); cmbCC2.set("items", ccNumbers.join("\n")); cmbCC2.set("text", "Second CC"); cmbCC2.set("tooltip", "Second CC Number: Select a CC number to humaniser."); const var knbCC2 = Content.addKnob("Second CC", 450, 100); knbCC2.setRange(0, 100, 1); knbCC2.set("suffix", "%"); knbCC2.set("tooltip", "Second CC: adjusts the CC value by a random percentage in the +-range selected."); //Functions //Callbacks function onNoteOn() { 	//Scale velocity based on the velocity table curve - min 1, max 126 	Message.setVelocity(1 + Math.floor((125 / 100) * (tblVel.getTableValue(Message.getVelocity()) * 100))); } function onNoteOff() { 	 } function onController() { 	 } function onTimer() { 	 } function onControl(number, value) { 	switch (number) 	{ 		case cmbType: //RR Type 			for (rrProcessor in rrProcessors) 			{ 				rrProcessor.setAttribute(0, value); 			} 		break; 		case cmbMode: //RR Mode 			for (rrProcessor in rrProcessors) 			{ 				rrProcessor.setAttribute(1, value); 			} 		break; 		case knbReset: //RR Reset 			for (rrProcessor in rrProcessors) 			{ 				rrProcessor.setAttribute(4, value); 			} 		break; 		case knbNoteOn: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(0, value); 			} 		break; 		case knbNoteOff: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(1, value); 			} 		break; 		case knbVelocity: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(2, value); 			} 		break; 		case knbFineTune: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(3, value); 			} 		break; 		case knbVolume: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(4, value); 			} 		break; 		case cmbCC1: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(5, value); 			} 		break; 		case knbCC1: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(6, value); 			} 		break; 		case cmbCC2: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(7, value); 			} 		break; 		case knbCC2: 			for (humaniserProcessor in humaniserProcessors) 			{ 				humaniserProcessor.setAttribute(8, value); 			} 		break; 	} }"> <EditorStates BodyShown="1" Visible="1" Solo="0" contentShown="1" onInitOpen="0" onNoteOnOpen="0" onNoteOffOpen="0" onControllerOpen="0" onTimerOpen="0" onControlOpen="0" Folded="0"/> <ChildProcessors/> <Content> <Control type="ScriptTable" id="tblVel" value="49" data="24...............vO...f+....9C...vO"/> <Control type="ScriptComboBox" id="Type" value="1"/> <Control type="ScriptComboBox" id="Mode" value="1"/> <Control type="ScriptSlider" id="Reset Time" value="0"/> <Control type="ScriptSlider" id="Note On" value="0"/> <Control type="ScriptSlider" id="Note Off" value="0"/> <Control type="ScriptSlider" id="Velocity" value="0"/> <Control type="ScriptSlider" id="FineTuning" value="0"/> <Control type="ScriptSlider" id="Volume" value="0"/> <Control type="ScriptComboBox" id="CC 1" value="1"/> <Control type="ScriptSlider" id="First CC" value="0"/> <Control type="ScriptComboBox" id="CC 2" value="1"/> <Control type="ScriptSlider" id="Second CC" value="0"/> </Content> </Processor>