Jump to content

Sustain pedal transform to note on AND note off?


Tyrrell
Go to solution Solved by Eric Cardenas,

Recommended Posts

I'm trying to trigger a long sustained note from a sustain pedal.

I'm using Logic's transformer to convert the live sustain pedal data to note on data so that I may play a single note with my foot. However, I can't figure out how to send 'note off' data when the sustain pedal lifts (sends '0') so I've created another transformer in series that sends velocity '0' when the sustain pedal is lifted. But this isn't really stopping the note - it's just sending another note that's so quiet it's basically off.

Is there not a way that the sustain pedal can be transformed to send both note on and off messages?

Link to comment
Share on other sites

Not sure if it can be done in Logic - but expect so. Try mapping your sustain pedal to both note on and note off eg CC64 >= 64 then nOte on as per table 1 at https://www.midi.org/specifications/item/table-1-summary-of-midi-message if CC64<64 then note off as per same table.
Link to comment
Share on other sites

  • Solution

Hi Tyrell.

See if this works for you:

 

//------------------------------------------------------------------------------
// Auth: Eric Cardenas
// dCre: 2016-10-13 11:38
// dMod: 2016-10-13 11:58
// Appl: Logic Pro X
// Task: Converts Sustain Pedal to Note.
// Tags: JavaScript, Logic
//------------------------------------------------------------------------------
const TITLE = "EC - Sustain to Note v 1.0";
const AUTHOR = "Script by Eric Cardenas";
const NOTES = MIDI._noteNames;
//------------------------------------------------------------------------------

function HandleMIDI(e) {
if (e instanceof ControlChange && e.number == 64 && e.value > 63) {
	var bordune = new NoteOn;
	bordune.pitch = GetParameter("Note");
	bordune.velocity = GetParameter("Velocity");
	bordune.send();

} else if (e instanceof ControlChange && e.number == 64 && e.value < 64) {
	var bOff = new NoteOff;
	bOff.pitch = GetParameter("Note");
	bOff.send();
} else {
	e.send();
}
}

function ParameterChanged(p, v) {
if (p == 1 ) {
	MIDI.allNotesOff();
    }
}

var PluginParameters = [{
    name: TITLE,
    type: "text"
}, {
    name: "Note",
    type: "menu",
    valueStrings: NOTES,
    defaultValue: 36
}, {
    name: "Velocity",
    type: "lin",
    numberOfSteps: 127,
    minValue: 0,
    maxValue: 127,
    defaultValue: 90
}, {
    name: AUTHOR,
    type: "text"
}];

Link to comment
Share on other sites

Absolutely brilliant, Eric - many, many thanks. It's channel dependent, which is great so I can use it as a sustain pedal sometimes and a note when needed. BTW, this is for performing a theatre show where I need many live triggers at once and the easiest way was to use a foot with the sustain pedal. A midi foot controller is the obvious next 'step'...

Many thanks again - I'm going to be getting into the scripter in future.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...