A technical support community for Apple Logic Pro users.

 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Composer Tools Pro Recall Script

Sun Feb 04, 2018 4:02 pm

Hi y'all,
I'm trying to replace a transform object in the environment that's used to recall patches in Composer Tools Pro on my iPad for articulation switching. It's a simple transform object that listens for CC 119( coming from CTPro on the iPad), and converts it to a user specified program change number and channel number. The transformer than filters all other information out and sends the program change and channel out to a specified Lemur port via another midi instrument in the environment. The program change number and channel number is the unique ID that Composer Tools Pro uses to identify which patch to recall.

If my explanation is confusing, here's a youtube example of the setup:

[youtube] https://www.youtube.com/watch?v=-c4q8hko380 [/youtube]

So, I know next to nothing about java scripting, but I can't use environment objects because of my workflow. I've moved away from using one huge template pre setup with these environment objects, and instead populate each project with channel strip presets and track stack patches as I go. The problem is those saved channel strips and patches don't bring along their attached environment objects though. But if I had a script that did the same thing, it would always travel with the instrument preset...e.g. Spitfire Violin 1 or whatever.

But I've failed to get anywhere cobbling together code from various examples. Here's what I've got so far.
/*Script that transforms control change 119 into a program change 
with user definable channel number and program change number and filter all other midi events
*/


var PluginParameters = [

   {
      name:"Channel",
      type:"valueStrings",
      defaultValue:1,
      minValue:1,
      maxValue:16,
     numberOfSteps:15
   },
                                 
   {
      name:"Program #",
      type:"valueStrings",
      defaultValue:0,
      minValue:0,
      maxValue:127,
      numberOfSteps:127
   },
];

function HandleMIDI(recall)
{
   if(recall instanceof ControlChange && recall.number == 119)
   {
      var p = new ProgramChange;         //generates program change message and saves as "p"
      var prog = GetParameter("Program #")      //retrieves program number from user input and saves to "prog"
      var chan = GetParameter("Channel")      //retrieves channel number from user input and saves to "chan"
      p.channel = chan            //sets program change to "prog"
      p.number = prog               //sets program change channel to "chan"
      recall.trace();               //filters out all other midi messages
      p.send();               //sends out only channel and program change #
   }
}


Did I mention I don't know what I'm doing? Anybody got helpful hints? So far, the script is just spitting out what I send it...CC 119.

It would also be GREAT if I could specify what port to send out the program change to, but as far as I can tell, that's not a capability? That would also help me to avoid having to cable each instrument to the instrument object that's pointing to the Lemur output port.
 
User avatar
Eric Cardenas
Moderator
Posts: 22735
Joined: Sat May 07, 2005 1:47 pm
Location: Uppsala, Sweden

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 1:30 am

Did you insert the script on an External Instrument track?
Eric Bradley Cardenas
EC Making Sound
Mac mini 2.6 GHz 16GB RAM Areca⚡RAID | MacBook Pro 2.3 GHz 16GB RAM | Os 10.14.5
Logic Pro 10.4.5 | RME Fireface UFX | Adam A7 + Sub8 | Spectrasonics | Softube
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 9:55 am

yes! That worked! Thanks!

So I know that my script works, but how do I get it to work with a regular software instrument?

Connecting a cable from a software instrument channel to a midi instrument with its output set to the correct port in the environment should perform the same function, no?
 
User avatar
Eric Cardenas
Moderator
Posts: 22735
Joined: Sat May 07, 2005 1:47 pm
Location: Uppsala, Sweden

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 10:29 am

No.
The MIDI FX sits between the MIDI input of the channel strip and its Instrument (it can also be used to control other plug-ins but it is all inside the same channel strip.
Eric Bradley Cardenas
EC Making Sound
Mac mini 2.6 GHz 16GB RAM Areca⚡RAID | MacBook Pro 2.3 GHz 16GB RAM | Os 10.14.5
Logic Pro 10.4.5 | RME Fireface UFX | Adam A7 + Sub8 | Spectrasonics | Softube
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 11:08 am

So...I'm out of luck?

There's no way to send the midi information generated by the script back out of the software instrument channel?

Sorry I sound thick-headed. I appreciate your help!
 
User avatar
Dewdman42
Posts: 3184
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 11:12 am

Unfortunately, midi generated inside a channel object cannot currently be cabled out of it in the environment. Please submit a feature request to Apple on this, as have I and many others.

The only work around if you want to use Scripter to drive other things in the environment, is to use the External instrument plugin that Eric mentioned and send the midi to an IAC port. Once it goes to the IAC port, then it will be coming back into Logic as if its a new midi coming in, and you can route it anywhere you want in the environment from there, by default it will go to the sequencer.
Last edited by Dewdman42 on Mon Feb 05, 2018 12:03 pm, edited 1 time in total.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.2, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 128gb ram
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 11:28 am

Damn.

Well thanks for all your help. I'll submit the feature request, but I don't think the workaround will work for my case.
 
User avatar
Dewdman42
Posts: 3184
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 11:34 am

Well you can get the midi back around through IAC, that will work... I'm not sure yet whether you'd be able to create a nice easy patch you can reload, but maybe. I didn't quite understand the complete midi flow, where does the midi come from that is feeding your script? and where do you need to get it to after going through your script?
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.2, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 128gb ram
 
User avatar
Eric Cardenas
Moderator
Posts: 22735
Joined: Sat May 07, 2005 1:47 pm
Location: Uppsala, Sweden

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 11:44 am

Don’t need to use the IAC since the events can be sent directly to the Lemour.

The question is what you are trying to achieve with this?
Eric Bradley Cardenas
EC Making Sound
Mac mini 2.6 GHz 16GB RAM Areca⚡RAID | MacBook Pro 2.3 GHz 16GB RAM | Os 10.14.5
Logic Pro 10.4.5 | RME Fireface UFX | Adam A7 + Sub8 | Spectrasonics | Softube
 
User avatar
Dewdman42
Posts: 3184
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 11:47 am

I thought i understood that he's wanting to have Lemur send midi to the script and from the script to various software instruments hosted in logic.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.2, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 128gb ram
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 12:02 pm

Here's the way it works using the transformer object in the environment.

All of my software instrument tracks are cabled to their own individual transform objects. The condition for all these individual transform objects is that they need to see CC 119. And they all perform the same operation but with different user inputted values. So, when CC 119 is met, you fix a program change to a user specified channel and program change number. My violin 1 track is cabled to a transform object that will spit out Channel 1, Program Change 0 for instance, and my violin 2 is cabled to a transform object that will spit out Channel 1, Program Change 1.

All of these transform objects are then a cabled to an instrument whose port is set to the virtual Lemur Daemon Output 0, which is the virtual input port on the iPad.

So, now I scroll to my Violin 1 patch in Logic. I press the "recall" button on the iPad app, which sounds out a CC 119 message. The selected track in Logic sees that, performs the transform operation and then sends back out the channel number and program change unique to it to the iPad app. When the iPad sees that info, it switches to the corresponding patch with all of its unique articulation switches, sliders, etc.

It makes it easier to keep track of hundreds of different instruments and their own unique keyswitches as well as any other custom controllers you'd like to build into the iPad patch.
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 12:06 pm

Right so simply:

Lemur sends CC119 to Logic and depending on what track is selected in Logic, Logic sends midi back to Lemur which tells it what patch to switch to.

This would also be a lot easier, if, whenever you select an instrument track in Logic it automatically sends out a custom midi message containing the channel number and program change number.
 
User avatar
Dewdman42
Posts: 3184
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 12:21 pm

I watched the video above and understand it a little better now, thanks for explaining it. What I didn't understand is that you're needing to send program change back to Lemur to dynamically switch its display depending on which track is selected.

if Lemur sends CC119 to LPX, then the currently selected track will receive that midi and if you have midifx script, then it will be processed, and then you can use External Instrument plugin to get it back out to Lemur. That would be fine except you are wanting to also have a software inst hosted on that same channel. So how can you go about having both your hosted instrument as well as the ext inst plugin in order to send the midi back to Lemur. Yes?

I don't think this is possible either.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.2, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 128gb ram
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 12:28 pm

Right, because a software instrument (that's hosting kontakt or an instance of VEPro), doesn't behave in the same way as an external instrument plugin?

The output (triangle thingy) that you cable from in the environment on a software instrument track is actually BEFORE the midi script in the midi signal flow I suppose?
 
User avatar
Dewdman42
Posts: 3184
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 12:35 pm

Mainly because of the following to limitations in Logic

  1. Midi that is generated inside a channel object cannot be cabled out in the enviornment.
  2. There is a workaround of using the External Instrument plugin to get the generated midi out to IAC, but....
  3. There is only one instrument plugin slot in a channel object in order to host an instrument. which means if you are hosting kontakt there, you can't host the external instrument plugin.

The triangle in the environment must be before the plugins do all their stuff, so its basically just a midi THRU on the channel object, any midi generated inside the channel object by plugins is sandboxed there and not sent out. But strangely, other kinds of stuff like moving the fader and what not is sent...

I will try to think today a bit about how this might be accomplished, but I think probably you are going to be forced to just make a template with environment objects in it. You might at least be able to do something smart with the template so that you don't have to know ahead of time how many tracks or what instruments will be loaded in, etc, but I will have to think about it a bit.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.2, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 128gb ram
 
User avatar
Dewdman42
Posts: 3184
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 1:48 pm

ok, here is a work around that might get you there, but you will have to buy 3rd party software. Plogue Bidule. Plogue Bidule has an object inside it for sending midi directly to a midi device.

So basically you can setup a mixer channel with your instrument like this, note Scripter is first midiFX, plogue bidule is second midifx (it will be used to send to lemur), then kontakt is in the instrument slot:

channel.jpg
channel.jpg (12.56 KiB) Viewed 2630 times


Then you configure plogue bidule to fork off the midi to a midi device like this. Note: I am using an IAC port because I don't have an actual lemur to send to. So just pretend that my picture is showing it cabled directly to the lemur midi device INPUT.

plogue.jpg
plogue.jpg (16.61 KiB) Viewed 2630 times


Note that its critical that you use plogue to cable to the midi INPUT of the lemur midi device. Lemur must not forward those midi notes thru to its own midi output, because if so then it will be sent back into LPX again and create a midi feedback loop, not good. Be careful not to send to IAC, for example, because that will definately loop back around into LPX.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.2, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 128gb ram
 
User avatar
Eric Cardenas
Moderator
Posts: 22735
Joined: Sat May 07, 2005 1:47 pm
Location: Uppsala, Sweden

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 1:59 pm

This is a perfect solution Dewdman!
Eric Bradley Cardenas
EC Making Sound
Mac mini 2.6 GHz 16GB RAM Areca⚡RAID | MacBook Pro 2.3 GHz 16GB RAM | Os 10.14.5
Logic Pro 10.4.5 | RME Fireface UFX | Adam A7 + Sub8 | Spectrasonics | Softube
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Mon Feb 05, 2018 8:05 pm

Just got back from a long day. Incredible! Thanks so much!
 
bpford
Topic Author
Posts: 9
Joined: Mon May 01, 2006 1:40 am

Re: Composer Tools Pro Recall Script

Tue Feb 06, 2018 5:29 pm

Hey Dewdman,

Thanks for turning me onto Bidule. I got it stuck in my head after I discovered it's capabilities, that it would be better if I could do this process with just one midi plugin (bidule), instead of 2 (bidule, my script). So this is what I built in Bidule and it seems to work like it should.

I haven't bought the full version of Bidule yet, so I'm not 100% positive it would work within Logic, but I can't see why it wouldn't.
Attachments
Bidule Recall Trigger.png
Bidule Recall Trigger.png (77.54 KiB) Viewed 2595 times
 
User avatar
Dewdman42
Posts: 3184
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Composer Tools Pro Recall Script

Tue Feb 06, 2018 5:36 pm

Very interesting way to avoid Scripter and it goes to show that Bidule in general is capable of doing some interesting midi transforms. Myself I find it easier to read and understand Javascript, but this is cool and since it gives you some sliders and stuff might be easier to tweak for each channel as you go... I can't think of any reason it wouldn't work in logic either.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.2, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 128gb ram