All notes off on button press question

Discuss Lemur and share techniques.
Post Reply
Rtech
Newbie
Posts: 26
Joined: 21 Dec 2012 20:30

All notes off on button press question

Post by Rtech »

I'm building a MIDI keyboard with pad objects triggering midi note-ons. I have a switch with 5 buttons that I am using to shift the MIDI notes up and down octaves. I am stuck on how to send a note-off or velocity=0 to all currently playing notes whenever the octave shift buttons are pressed (to avoid stuck notes after the octave is shifted). Any thoughts on how to do this?
whatisvalis
Regular
Posts: 153
Joined: 31 Dec 2011 17:12

Re: All notes off on button press question

Post by whatisvalis »

Check the factory content Studio Combo template
Rtech
Newbie
Posts: 26
Joined: 21 Dec 2012 20:30

Re: All notes off on button press question

Post by Rtech »

I already have. I don't like the methodology they used in their code. I will be shifting the keyboard by single notes as well as octaves. The code in the example won't work properly for that.
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: All notes off on button press question

Post by Macciza »

Hi
Seriously, adding support for single note shifting to that project would be pretty simple . . .
For turning the notes off when you press octave or note shift I would look at using the z variable
Basically if z is 1 (object touched) then the velocity equals 0 .. ..
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Rtech
Newbie
Posts: 26
Joined: 21 Dec 2012 20:30

Re: All notes off on button press question

Post by Rtech »

Macciza wrote:Hi
Seriously, adding support for single note shifting to that project would be pretty simple . . .
For turning the notes off when you press octave or note shift I would look at using the z variable
Basically if z is 1 (object touched) then the velocity equals 0 .. ..
How exactly would you shift the example by single notes? I'm shifting the pitches independantly through an expression placed on each note (pad object).

Also, I found that the switch object only has an x variable. So I can't use the z variable like you mention. But that's along the lines of what I want to do. I tried adding a custom midi message to the switch, to send a note off or note on with vel=0 message to all currently playing note pitches once pressed, but couldn't get it to work. I also tried cc123 on the switch with no luck either.
mat
Regular
Posts: 124
Joined: 08 Dec 2011 09:21
Location: Germany
Contact:

Re: All notes off on button press question

Post by mat »

Hey RTech,

maybe have a look, how I solved the killmidi problem on Scalomat:
http://liine.net/en/community/user-library/view/419/
(which is by the way a midikeyboard where you can "shifting the keyboard by single notes as well as octaves" if I understand right)

Code is like this /executed on a Midikillswitch:

Code: Select all

decl j;
for (j=0; j<127; j++)
{
noteout (0,j,0,Midichannel.selection+1);
}
so I simply go through all notes by a for loop.
You might fit that to your own needs and killing only discrete notes.

btw: I think for deleting notes by cc 123 the "remote IN" of that Midiport has also to be opened in the Application.
I wasn´t aware of that way - so thanks Macciza for the tip - I find it a bit more elegant than my way!
But if you want to rely on noteIN only on that port, the above script works.

Hope that helped
mat
Lemur modules and sequencer: http://music-interface.com
Setup: Win7professional 32bit, Intel Core 2 Duo @ 2,66 GHz.,Tascam US-144MKII, Ableton Live 8.4,
Arturia Analog Lab., Max/Msp, Maxforlive, Lemur Legacy + Ipad, Akai MPK61, Doepfer Pocket Control
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: All notes off on button press question

Post by Macciza »

Hi
I simply meant that if most of the functionality is there it should be simple to extend it rather then trying to re-invent it all . ..
Not sure of what you mean by 'don't like the methodology' - it looks pretty concise and leverages arrays quite nicely . . .
I would have to have a bit of look to work it out but I believe it should not be as much work as recoding - unless you have a better methodology in mind . .
One approach might be to find the non-nulls in the final array and shift them along to your preferred notes
Another might be to extract the currently playing notes to an array and use that info to turn off only those notes

Re the 'z' variable - I simply meant detecting touch in someway and using that info to trigger your note-off requirement
I guess x vars could be used similarly - if your shift button is pressed and a notekey is also pressed then send send NoteOff or CC 123
Or you could even just have it that whenever you press any note shift key it sends CC 123

CC 123 -All Notes Off is a standard defined MIDI message and mosts synths should implement it
Live certainly seems to - sending CC 123 to a track should stop any notes that are playing

If you want advice on your particular method it really helps to post your project so we have an idea of how you are approaching the problem
Otherwise we are somewhat stabbing in the dark to try and come up with something that matches your methodology
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Rtech
Newbie
Posts: 26
Joined: 21 Dec 2012 20:30

Re: All notes off on button press question

Post by Rtech »

Thanks for the help. Mat, that's a great idea to use a loop for all notes off.

I ended up getting the notes off to work by adding a script to the octave switches. A really simple "on expression" send cc123 out. I had to mess around a little with the trigger modes to get it to work. What would be better though is to send note offs to exactly the pitches that are playing.

I put the keyboard template up on my site if you want to take a look at it:
http://desertsoundstudios.com/devices

My method was to assign an expression (for octave switching) to each individual note. There's probably a way to use arrays like the example template. But this way seemed to work ok.

Now I'm interested in adding a hold switch. So note offs on key release would be disregarded, turning the keys into toggles or holding the notes until the button is turned off. Any thoughts on how to start on this? Maybe change the attribute of the trigger mode of the keys through a script on a switch?
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: All notes off on button press question

Post by Macciza »

Ok
I thought you simply wanted to shift/transpose the notes played by the keys ie (C plays C# etc) not actually shift the keys
Though I am equally sure that could also be achieved with the other project anyway . .
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
mat
Regular
Posts: 124
Joined: 08 Dec 2011 09:21
Location: Germany
Contact:

Re: All notes off on button press question

Post by mat »

Hey RTech,
....turning the keys into toggles or holding the notes until the button is turned off.
again, already done on Scalomat...you really should have a look at it!
Furthermore a "sustain" mode which sends delayed note off indicated by the pads light.
But I understand that you want to create your own templates ;)

so code for switch mode is like this, triggered on expression Pads.x:

Code: Select all

if (Mode.x[1]==1)
{
hld = !Pads.x;
Pads.x = !hld;
}
else return;
"hld" is a variable and "Mode" is for switching the playmodes.
It works perfect as I had all Notepads in 1 Padobject. You might have more single Padobjects for your Keyboard (black and white keys), so you will have to add this function to all Pads.

cheers*mat
Lemur modules and sequencer: http://music-interface.com
Setup: Win7professional 32bit, Intel Core 2 Duo @ 2,66 GHz.,Tascam US-144MKII, Ableton Live 8.4,
Arturia Analog Lab., Max/Msp, Maxforlive, Lemur Legacy + Ipad, Akai MPK61, Doepfer Pocket Control
Post Reply