A technical support community for Apple Logic Pro users.

 
User avatar
jimdilian
Topic Author
Posts: 376
Joined: Sat Aug 19, 2017 4:05 pm

Script to "clone" Midi note? and CC ?

Thu Dec 05, 2019 7:53 am

does anyone knows a script to clone Midi Note 7 (G-2) to let's say Midi Note 1 (C#-2)?

so when I hit the Midi Note 7 will play 7 and 1 midi note?

and I looking for the same but with CC so When CC4 moves CC20 will move to ? like a clone?

I've searching for this 2 scripts on the net but just can't find them... maybe because I using the wrong words..in english..

Thank very very much in advanced if any one knows how to do any of this 2 things with logic pro x script
iMac (Retina 4K, 21.5-inch, Late 2015)
Processor : 3.3 GHz Intel Core i7
16 GB 1867 MHz DDR3
Mac os Mojave (latest update)
 
User avatar
David Nahmani
Site Admin
Posts: 85856
Joined: Sat Mar 05, 2005 12:16 am
Contact:

Re: Script to "clone" Midi note? and CC ?

Thu Dec 05, 2019 8:54 am

Do you want to do that for all notes? And all CCs? If yes, then you can use the Modifier MIDI FX plug-in for that. Click "Thru". Use one Modifier for the Note vent, and another for the CC.

Otherwise, you can use a Transformer object in the MIDI Environment to target specific note and CC numbers.
David Nahmani
• My Logic Pro X 10.5 book (Apple Pro Training Series)
Contact me for Private Lessons
Logic Pro X 10.6.1
MacBook Air 1.3 GHz i5 — MacOS X 11.0.1 — 4 GB RAM
iMac 3.2 GHz Quad Core i5 — MacOS X 10.15.4 — 8 GB RAM
 
User avatar
Dewdman42
Posts: 3315
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Script to "clone" Midi note? and CC ?

Thu Dec 05, 2019 1:06 pm

Easy task for scripter too
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
Dewdman42
Posts: 3315
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Script to "clone" Midi note? and CC ?

Thu Dec 05, 2019 3:36 pm

Here is simple CC clone, for example as you described,.

function HandleMIDI(event) {
    if(event instanceof ControlChange && event.number == 4) {
        event.send();
        event.number = 20;
        event.send();
    }
}
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
jimdilian
Topic Author
Posts: 376
Joined: Sat Aug 19, 2017 4:05 pm

Re: Script to "clone" Midi note? and CC ?

Thu Dec 05, 2019 4:25 pm

Dewdman42 wrote:
Here is simple CC clone, for example as you described,.

function HandleMIDI(event) {
    if(event instanceof ControlChange && event.number == 4) {
        event.send();
        event.number = 20;
        event.send();
    }
}

Thank you very much working now .. how can I do that for midi notes only 1 note ? so when I hit certain note let say Note 7 another midi note will play too for example midi note 1.. ?
only for 1 midi note
iMac (Retina 4K, 21.5-inch, Late 2015)
Processor : 3.3 GHz Intel Core i7
16 GB 1867 MHz DDR3
Mac os Mojave (latest update)
 
User avatar
Dewdman42
Posts: 3315
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Script to "clone" Midi note? and CC ?

Thu Dec 05, 2019 6:58 pm

function HandleMIDI(event) {
    if(event instanceof Note && event.pitch == 7) {
        event.send();
        event.pitch = 1;
        event.send();
    }
}
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
David Nahmani
Site Admin
Posts: 85856
Joined: Sat Mar 05, 2005 12:16 am
Contact:

Re: Script to "clone" Midi note? and CC ?

Thu Dec 05, 2019 11:41 pm

I believe you need to send the other notes also:

    if(event instanceof Note && event.pitch == 7) {
        event.send();
        event.pitch = 1;
        event.send();
    }
    else {
          event.send();
    }
}
David Nahmani
• My Logic Pro X 10.5 book (Apple Pro Training Series)
Contact me for Private Lessons
Logic Pro X 10.6.1
MacBook Air 1.3 GHz i5 — MacOS X 11.0.1 — 4 GB RAM
iMac 3.2 GHz Quad Core i5 — MacOS X 10.15.4 — 8 GB RAM
 
User avatar
Dewdman42
Posts: 3315
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Script to "clone" Midi note? and CC ?

Fri Dec 06, 2019 12:10 am

yea true, neither script does that, but I am tiring for writing scripts for people, just providing bare bones example, they can fill in the blanks. or you! good catch.
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
David Nahmani
Site Admin
Posts: 85856
Joined: Sat Mar 05, 2005 12:16 am
Contact:

Re: Script to "clone" Midi note? and CC ?

Fri Dec 06, 2019 1:11 am

Yeah I understand. Believe it or not, this was my very first attempt at doing something/anything at all in the Scripter! :D This is truly empowering though.
David Nahmani
• My Logic Pro X 10.5 book (Apple Pro Training Series)
Contact me for Private Lessons
Logic Pro X 10.6.1
MacBook Air 1.3 GHz i5 — MacOS X 11.0.1 — 4 GB RAM
iMac 3.2 GHz Quad Core i5 — MacOS X 10.15.4 — 8 GB RAM
 
User avatar
jimdilian
Topic Author
Posts: 376
Joined: Sat Aug 19, 2017 4:05 pm

Re: Script to "clone" Midi note? and CC ?

Wed Dec 18, 2019 3:05 pm

sorry where do I put the CC11 in the script ? logic receives CC11 from my keyboard and I will like .. to send CC11 and CC4.. like clone the cc11 so the instrument can receive 2 CC at the same time.. but I will use only 1 controller of course..

if(event instanceof Note && event.pitch == 7) {
event.send();
event.pitch = 1;
event.send();
}
else {
event.send();
}
}
iMac (Retina 4K, 21.5-inch, Late 2015)
Processor : 3.3 GHz Intel Core i7
16 GB 1867 MHz DDR3
Mac os Mojave (latest update)
 
User avatar
David Nahmani
Site Admin
Posts: 85856
Joined: Sat Mar 05, 2005 12:16 am
Contact:

Re: Script to "clone" Midi note? and CC ?

Wed Dec 18, 2019 3:11 pm

jimdilian wrote:
sorry where do I put the CC11 in the script ?

The original question was about cloning CC4 to CC20. If you want to clone any CC into any other CC just replace the 4 and 20 values in Dewdman42's script.
David Nahmani
• My Logic Pro X 10.5 book (Apple Pro Training Series)
Contact me for Private Lessons
Logic Pro X 10.6.1
MacBook Air 1.3 GHz i5 — MacOS X 11.0.1 — 4 GB RAM
iMac 3.2 GHz Quad Core i5 — MacOS X 10.15.4 — 8 GB RAM
 
User avatar
Dewdman42
Posts: 3315
Joined: Tue Sep 09, 2014 3:01 pm
Location: Salt Lake City, UT

Re: Script to "clone" Midi note? and CC ?

Wed Dec 18, 2019 8:39 pm

function HandleMIDI(event) {
    event.send();
    if(event instanceof ControlChange && event.number == 11) {
        event.number = 4;
        event.send();
    }
}
OSX 10.15 (Catalina) on OpenCore - Logic Pro 10.6.1, VePro7, Mainstage3
5,1 MacPro 3.46ghz x 12 96gb ram
 
User avatar
jimdilian
Topic Author
Posts: 376
Joined: Sat Aug 19, 2017 4:05 pm

Re: Script to "clone" Midi note? and CC ?

Wed Dec 18, 2019 9:46 pm

Dewdman42 wrote:
function HandleMIDI(event) {
    event.send();
    if(event instanceof ControlChange && event.number == 11) {
        event.number = 4;
        event.send();
    }
}



thank you working now ¡
but the note script does not works.. for me.. I mean it does.. but mute all the rest of the midi notes from my Electronic-Drum..
iMac (Retina 4K, 21.5-inch, Late 2015)
Processor : 3.3 GHz Intel Core i7
16 GB 1867 MHz DDR3
Mac os Mojave (latest update)
 
User avatar
Arnaud
Posts: 782
Joined: Sun Dec 17, 2006 10:37 am

Re: Script to "clone" Midi note? and CC ?

Thu Dec 19, 2019 12:00 am

@jimdilian: Just read the discussion between David and Drewdman42 above in full and you'll have the answer to your last question, man.

@David and Drewdman42: thanks a lot, you rock!
Logic Pro X 10.4.8 - OS X Catalina 10.15.3
MacBook Pro retina 16" late-2019, 2x2.4 GHz Core i9, 64 GB 2666 MHz DDR4, 8 TB SSD

Audio interface: RME Fireface UCX - MIDI Interface: MIDIMAN USB Midisport 4x4

Keyboard midi controllers: Korg M1, NI Komplete Kontrol S88 mk1
Additional control surface: Logic Remote (on iPadAir 2)

https://www.evernoize.com
 
User avatar
David Nahmani
Site Admin
Posts: 85856
Joined: Sat Mar 05, 2005 12:16 am
Contact:

Re: Script to "clone" Midi note? and CC ?

Thu Dec 19, 2019 12:23 am

Yes, have you tried using my script here ——> viewtopic.php?p=756663#p755446
David Nahmani
• My Logic Pro X 10.5 book (Apple Pro Training Series)
Contact me for Private Lessons
Logic Pro X 10.6.1
MacBook Air 1.3 GHz i5 — MacOS X 11.0.1 — 4 GB RAM
iMac 3.2 GHz Quad Core i5 — MacOS X 10.15.4 — 8 GB RAM