Jump to content

MIDI script - note/sustain off, break external MIDI loop


zplane

Recommended Posts

I've attempted to address 2 issues with the MIDI script below:

 

(1) If you stop playback in the middle of sustained MIDI notes, then you may have to manually send controller reset and/or note off messages to silence everything. And I think I've read that with some old synths, you may need to do both.

 

(2) I've seen many posts about trying to get around having a MIDI feedback loop with external synths - i.e., where you don't want to turn local mode off on your external synths. So with the track for the external synth selected in the arrange window, you hear doubling of notes.

 

...For (1)....

 

This script tests to see if the transport is in play mode or not, (i.e., stopped), via testing info.playing. When the transport stops, this script will send send MIDI note off on all MIDI channels via the builtin MIDI object - and then it also sends the MIDI controller message (64) for sustain with an off value (I chose 10, but you could choose a different value) - on a range of MIDI channels.

 

Your external synths may be set to receive/transmit program change on MIDI channel 16, and then patch send/receive on maybe channels 14, 15. So the loop "while (i < 13)" only iterates thru channels 1-12, but you can change that to be whatever range you like.

 

If you add this script to a MIDI track that plays back MIDI (on an external synth), then with all the trace statements enabled, you should see something like the output from the (attached) screenshot of the MIDI console. But I suggest you save and use a version of the script with all the "Trace" "cc.trace" "event.trace" statements commented out. I also found that with too many trace statements the MIDI script console cannot keep up with it, and you don't see all the output. (Hmm - may be a bug).

 

...For (2)....

 

Since MIDI events are only being sent if info.playing is true, then with the transport stopped and the track for an external synth selected in the arrange window - then no MIDI events are transmitted and the MIDI feedback loop to external synths should be broken.

 

But as it turns out, info.playing is apparently also true during recording. Hence the MIDI loop will not be broken for an external synths track selected in the arrange window during recording.

 

I have tried to find a builtin test or object to test for recording in javascript, but I don't see anything in the example scripts (info.recording apparently does not exist). So this script alone is not a complete solution to break MIDI loops with external synths.

 

...And Then With External Instrument Plugin...

 

With the use of the external instrument plugin to set the I/O to your external synths, you can specify no output for tracks you record on and conversely no input for playback only tracks in the arrange window. Then you have to drag MIDI from the "record" tracks to the "playback" tracks (again for external synths setups w/o local mode off). Along with this workaround, this script on playback only MIDI tracks should eliminate MIDI loops for external synths.

 

Or at least this is the best workaround I have for now; I hope something here helps folks out.

 

I've run this on Mac OS 10.10.5 (Yosemite) with Logic Pro 10.2.3.

note_and_sus_off_5_debug.thumb.png.6250d61fd209699eaa7f1ec657e4cc2a.png

screenshot including javascript output

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...