Skip to content

Instantly share code, notes, and snippets.

@hatzka-nezumi
Created April 28, 2017 01:45
Show Gist options
  • Save hatzka-nezumi/24ba99fb9b31a11f3730644a4cfb0b34 to your computer and use it in GitHub Desktop.
Save hatzka-nezumi/24ba99fb9b31a11f3730644a4cfb0b34 to your computer and use it in GitHub Desktop.
Logic humanizer plugin (for Scripter)
// copyright 2017 ViKomprenas - Creative Commons Zero
var PluginParameters = [
{
name: "Velocity Range",
type: "lin",
defaultValue: 6,
minValue: 0,
maxValue: 127,
numberOfSteps: 127
},
{
name: "Maximum Note Delay (ms)",
type: "lin",
defaultValue: 30,
minValue: 0,
maxValue: 1000,
numberOfSteps: 1000
}
];
function HandleMIDI(event)
{
if (event instanceof NoteOn || event instanceof NoteOff) {
const velRange = GetParameter("Velocity Range");
event.velocity += Math.round(Math.random() * velRange - (velRange / 2));
if (event instanceof NoteOn)
event.sendAfterMilliseconds(Math.round(Math.random() *
GetParameter("Maximum Note Delay (ms)")));
else
event.send();
} else {
event.send();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment