Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

"Smart" bass instrument (lowest note)?

Is there a way in Mainstage 3 to define a channel strip to only be active for the lowest note that is being played?


The idea is to set up a bass instrument that will automatically play along with whatever chords are being played. A split (even with a floating split point) won't quite work, as potentially multiple notes will trigger the bass sound (or not necessarily the lowest note if it's a solo instrument, it depends how you "roll" the chord).


Does anyone know if this is possible? And, if so, how?

Posted on Jun 14, 2015 9:57 PM

Reply
Question marked as Best reply

Posted on Jun 17, 2015 7:21 AM

You can use the MIDI Plug-in "Scripter" to do that. Below is the script, you need to paste the text into the scripter editor (press "open script in Editor", delete everything in the text editor window and paste stuff below).

Best,

DaCaptain


// Script start



var BassNoteNumber = 1000;

var NoteIsOn = 0;



function SwitchNote(NoteNumber, Velo, state)

{

if(Velo == 0)

return state;


if(state == 0)

{

var on = new NoteOn;

on.pitch = NoteNumber;

on.velocity = Velo;

on.send();

}

else

{

var off = new NoteOff;

off.pitch = NoteNumber;

off.velocity = Velo;

off.send();

}

state = 1 - state;

return state;

}



function Reset()

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn);

BassNoteNumber = 1000;

}





function HandleMIDI(event)

{

if(event instanceof NoteOn)

{

var Pitch = event.pitch;


if(Pitch < BassNoteNumber)

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn); // switch old note off


BassNoteNumber = Pitch;

NoteIsOn = SwitchNote(BassNoteNumber, event.velocity, NoteIsOn); // switch new Note on

}

}

else

if(event instanceof NoteOff)

{

var Pitch = event.pitch;


if(Pitch == BassNoteNumber)

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn); // switch old note off

BassNoteNumber = 1000;

}


}

else

event.send();


}


// script end

11 replies
Question marked as Best reply

Jun 17, 2015 7:21 AM in response to rizariza

You can use the MIDI Plug-in "Scripter" to do that. Below is the script, you need to paste the text into the scripter editor (press "open script in Editor", delete everything in the text editor window and paste stuff below).

Best,

DaCaptain


// Script start



var BassNoteNumber = 1000;

var NoteIsOn = 0;



function SwitchNote(NoteNumber, Velo, state)

{

if(Velo == 0)

return state;


if(state == 0)

{

var on = new NoteOn;

on.pitch = NoteNumber;

on.velocity = Velo;

on.send();

}

else

{

var off = new NoteOff;

off.pitch = NoteNumber;

off.velocity = Velo;

off.send();

}

state = 1 - state;

return state;

}



function Reset()

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn);

BassNoteNumber = 1000;

}





function HandleMIDI(event)

{

if(event instanceof NoteOn)

{

var Pitch = event.pitch;


if(Pitch < BassNoteNumber)

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn); // switch old note off


BassNoteNumber = Pitch;

NoteIsOn = SwitchNote(BassNoteNumber, event.velocity, NoteIsOn); // switch new Note on

}

}

else

if(event instanceof NoteOff)

{

var Pitch = event.pitch;


if(Pitch == BassNoteNumber)

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn); // switch old note off

BassNoteNumber = 1000;

}


}

else

event.send();


}


// script end

Jun 21, 2015 8:14 PM in response to DaCaptain

Sorry I haven't had a chance to reply until now, but...


... that worked a treat. Thank you so much - I used it on the weekend when we were without a bass player and it just helped fill out the bottom end a little, which was fantastic.


Thanks so much for your quick help. I will definitely take a closer look at the scripting language, as I can see the potential to do some really useful things with it.


Kind regards.

Dec 6, 2016 9:17 AM in response to capitanlord

That could be done, but it is a lot more complicated. You need an array to track the active notes and check this array on every note-on/off, if it has something like a second/third/... note. The array would be something like a virtual keyboard. Once you see, it has three notes, you can send out the second note of that chord. I'm a bit short on time, so this time I can't write you a script. Do you want to try it on your own?


Best,


DaCaptain

Dec 12, 2016 8:48 AM in response to capitanlord

Loving the script as well. Any chance you could share the modified version that plays only the highest note?


Been using the script posted to fill out our low end and it's working very nicely. Pianist can play as normal, and get get a bass too. It's actually cleaner than having a bassist and pianist together, because the parts match perfectly.


With Christmas season here, I'm hoping to add a few bell and chime sounds to the setup, and would love to have those on only the highest note.


Thanks to all of you who have contributed to this.

Dec 13, 2016 2:51 AM in response to DaveCook4782

I think, you just need to change a few lines of code.

Change this line


if(Pitch < BassNoteNumber)


to this


if(Pitch > BassNoteNumber)


Then it picks the highest note.

The initialization BassNoteNumber = 1000 needs to be changed to BassNoteNumber = 0. This happens in two places (line 14 & 72).

To reduce confusion about the variable's name, change BassNoteNumner to LeadNoteNumber, e.g.


Hope this helps,


DaCaptain

Dec 13, 2016 10:25 AM in response to DaCaptain

That worked beautifully, thank you. Now a random church in rural Kentucky has you to thank for the bit of Christmas magic that'll add to the sound.


For anyone who needs it, here's the script with Cap's modification for highest note. I kept the name "bassnote" to make the change easiest.


// Script start



var BassNoteNumber = 1;

var NoteIsOn = 0;



function SwitchNote(NoteNumber, Velo, state)

{

if(Velo == 0)

return state;


if(state == 0)

{

var on = new NoteOn;

on.pitch = NoteNumber;

on.velocity = Velo;

on.send();

}

else

{

var off = new NoteOff;

off.pitch = NoteNumber;

off.velocity = Velo;

off.send();

}

state = 1 - state;

return state;

}



function Reset()

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn);

BassNoteNumber = 1;

}





function HandleMIDI(event)

{

if(event instanceof NoteOn)

{

var Pitch = event.pitch;


if(Pitch > BassNoteNumber)

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn); // switch old note off


BassNoteNumber = Pitch;

NoteIsOn = SwitchNote(BassNoteNumber, event.velocity, NoteIsOn); // switch new Note on

}

}

else

if(event instanceof NoteOff)

{

var Pitch = event.pitch;


if(Pitch == BassNoteNumber)

{

if(NoteIsOn == 1)

NoteIsOn = SwitchNote(BassNoteNumber, 1, NoteIsOn); // switch old note off

BassNoteNumber = 1;

}


}

else

event.send();


}


// script end

"Smart" bass instrument (lowest note)?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.