Logic Pro Plugin Scripts

How to install the scripts

Installation

Usage

Contributing

Contributions to this project are welcome. If you encounter any issues or have any feature requests, please open an issue on the project's GitHub repository.


Credits

This plugin was built with the help of Frank Faruk Ceviz and ChatGPT

License

This plug-in is open source and free to use for personal and commercial purposes under the MIT License.



MIDI Note Range Filter


Description: This script is a MIDI plugin that allows users to filter out notes This script is a MIDI plugin that allows users to filter out notes outside a specific range. The plugin includes two sliders that allow users to set the low and high note values. When a MIDI event is received, the plugin checks if it is a note on or note off event and compares the pitch of the event to the low and high note values. If the pitch is outside the range, the plugin sends an "all notes off" message to stop the note from playing and does not pass the event through. If the pitch is inside the range, the plugin passes the event through.

Features

Script:


/* MIDI Note Range Filter
Builded with Frank Faruk Ceviz & ChatGPT */

// Define MIDI plug-in controls
var PluginParameters = [  {
    name: "Low Note",
    type: "lin",
    minValue: 0,
    maxValue: 127,
    numberOfSteps: 127,
    defaultValue: 0
  },
  {
    name: "High Note",
    type: "lin",
    minValue: 0,
    maxValue: 127,
    numberOfSteps: 127,
    defaultValue: 127
  }
];

// Pass events through and filter out notes outside the user-set range
function HandleMIDI(event) {
  // Get the user-set low and high note values from the sliders
  var lowNote = Math.floor(GetParameter("Low Note"));
  var highNote = Math.floor(GetParameter("High Note"));

  // Check if the event is a note on or note off event
  if (event instanceof NoteOn || event instanceof NoteOff) {
    // Get the MIDI note number of the event
    var noteNumber = event.pitch;
 
    // Check if the note is outside the user-set range
    if (noteNumber < lowNote || noteNumber > highNote) {
      // If so, send an "all notes off" message to stop the note from playing
      MIDI.allNotesOff();
   
      // And don't pass the event through
      return;
    }
  }

  // Pass the event through
  event.send();
}



Control the Legato Length with the Legato Length Slider

The Legato Length Slider is a graphical control element that resembles a slider, allowing you to adjust the legato length according to your preference. By moving the slider, you can control the smoothness and duration of the legato effect in real-time. The script utilizes MIDI events to apply the legato effect. Whenever a MIDI event is triggered, it is sent through the script. The original MIDI event is first transmitted to ensure it reaches its intended destination. Then, the Legato Length Slider value is retrieved to determine the desired legato length. Based on the selected value, a control change message is generated with the appropriate legato length settings. The script assigns the control change message to controller 64, which corresponds to the sustain controller. The control change message is then sent to your MIDI output, ensuring the legato effect is applied accurately. Additionally, the script provides a trace of the control change event, allowing you to monitor the legato settings and ensure they match your desired configuration. To experience this functionality, simply visit our website and interact with the Legato Length Slider. Explore the range from staccato to legato and enjoy the smoothness and expressiveness it brings to your MIDI performances.




Script:


// Define MIDI plug-in controls
var PluginParameters = [
  {
    name: "Legato Length",
    type: "lin",
    defaultValue: 0.5,
    minValue: 0,
    maxValue: 1
  }
];

function HandleMIDI(event) {
  event.send(); // Send the original MIDI event

  var legatoLength = GetParameter("Legato Length"); // Get the value of the legato length parameter

  var cc = new ControlChange(); // Create a new control change message
  cc.number = 64; // Set it to controller 64 (sustain)
  cc.value = Math.round(legatoLength * 127); // Scale the legato length to the range 0-127
  cc.send(); // Send the control change event
  cc.trace(); // Print the event to the console

  event.send(); // Send the original MIDI event again
}

1.3 MIDI Note Range Filter with Probability Gate and Velocity Slider


This plugin allows you to filter out MIDI notes outside of a user-set range, with the added ability to set a probability gate and note velocity slider. Built with Frank Faruk Ceviz and ChatGPT. 


Script:


/* MIDI Note Range Filter with Probability Gate and Velocity Slider
Built with Frank Faruk Ceviz & ChatGPT */

// Define MIDI plug-in controls
var PluginParameters = [
{
name: "High Note",
type: "lin",
minValue: 0,
maxValue: 127,
numberOfSteps: 127,
defaultValue: 127
},
{
name: "Low Note",
type: "lin",
minValue: 0,
maxValue: 127,
numberOfSteps: 127,
defaultValue: 0
},
{
name: "Probability",
type: "linear",
minValue: 0,
maxValue: 100,
numberOfSteps: 100,
defaultValue: 50,
unit: "%"
},
{
name: "Note Velocity",
type: "lin",
minValue: 1,
maxValue: 127,
numberOfSteps: 126,
defaultValue: 80
}
];

var probability = 50;

function HandleMIDI(event) {
// Get the user-set low and high note values from the sliders
var lowNote = Math.floor(GetParameter("Low Note"));
var highNote = Math.floor(GetParameter("High Note"));

// Check if the event is a note on or note off event
if (event instanceof NoteOn || event instanceof NoteOff) {
// Get the MIDI note number of the event
var noteNumber = event.pitch;

// Check if the note is outside the user-set range
if (noteNumber < lowNote || noteNumber > highNote) {
  // If so, send an "all notes off" message to stop the note from playing
  MIDI.allNotesOff();

  // And don't pass the event through
  return;
}
}

// Set the velocity of the event based on the user-set slider value
event.velocity = GetParameter("Note Velocity");

// Check if the event should be sent based on probability
if (eventShouldSend()) {
// Send the event
event.send();
}
}

function ParameterChanged(param, value) {
if (param === 2) {
probability = value;
}
}

function eventShouldSend() {
return (Math.ceil(Math.random() * 100) <= probability);
}

// Pass events through and filter out notes outside the user-set range, and set velocity based on slider value.


1.5 MIDI Note Range Filter with MIDI Volume Slider, Probability Gate, and Note Velocity Wrapping Sliders

This is a JavaScript MIDI plugin for Logic Pro that allows users to filter MIDI note events based on a range of notes defined by two sliders, and set the volume of the events with a separate slider.

The plugin has four controls:

When a MIDI event is received, the plugin checks if it is a note on or note off event, and if so, it checks if the MIDI note number is within the range set by the High Note and Low Note sliders. If the note is outside the range, the plugin sends an "all notes off" message to stop the note from playing and does not pass the event through.

The plugin then sets the velocity of the event based on the MIDI Volume slider, and checks whether the event should be sent based on the Probability slider. If the event should be sent, it sends the event through with the modified velocity, and then restores the original velocity of the event.


Script:



/* MIDI Note Range Filter with Probability Gate and MIDI Volume Slider
Built with Frank Faruk Ceviz & ChatGPT */

// Define MIDI plug-in controls
var PluginParameters = [
  {
    name: "High Note",
    type: "lin",
    minValue: 0,
    maxValue: 127,
    numberOfSteps: 127,
    defaultValue: 127
  },
  {
    name: "Low Note",
    type: "lin",
    minValue: 0,
    maxValue: 127,
    numberOfSteps: 127,
    defaultValue: 0
  },
  {
    name: "Probability",
    type: "linear",
    minValue: 0,
    maxValue: 100,
    numberOfSteps: 100,
    defaultValue: 50,
    unit: "%"
  },
  {
    name: "MIDI Volume",
    type: "lin",
    minValue: 0,
    maxValue: 127,
    numberOfSteps: 127,
    defaultValue: 100
  }
];

var probability = 50;

function HandleMIDI(event) {
  // Get the user-set low and high note values from the sliders
  var lowNote = Math.floor(GetParameter("Low Note"));
  var highNote = Math.floor(GetParameter("High Note"));

  // Check if the event is a note on or note off event
  if (event instanceof NoteOn || event instanceof NoteOff) {
    // Get the MIDI note number of the event
    var noteNumber = event.pitch;

    // Check if the note is outside the user-set range
    if (noteNumber < lowNote || noteNumber > highNote) {
      // If so, send an "all notes off" message to stop the note from playing
      MIDI.allNotesOff();

      // And don't pass the event through
      return;
    }
  }

  // Store the original velocity of the event
  var originalVelocity = event.velocity;

  // Set the velocity of the event based on the user-set slider value
  event.velocity = Math.round(originalVelocity * (GetParameter("MIDI Volume") / 127));

  // Check if the event should be sent based on probability
  if (eventShouldSend()) {
    // Send the event
    event.send();
  }

  // Restore the original velocity of the event
  event.velocity = originalVelocity;
}

function ParameterChanged(param, value) {
  if (param === 2) {
    probability = value;
  }
}

function eventShouldSend() {
  return (Math.ceil(Math.random() * 100) <= probability);
}

// Pass events through and filter out notes outside the user-set range, and set velocity based on slider value.
// Store the original velocity of the event and restore it after sending the event.