Page 1 of 1

All notes off on button press question

Posted: 22 Oct 2013 02:11
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?

Re: All notes off on button press question

Posted: 22 Oct 2013 19:24
by whatisvalis
Check the factory content Studio Combo template

Re: All notes off on button press question

Posted: 22 Oct 2013 22:05
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.

Re: All notes off on button press question

Posted: 23 Oct 2013 02:11
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 .. ..

Re: All notes off on button press question

Posted: 23 Oct 2013 17:15
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.

Re: All notes off on button press question

Posted: 23 Oct 2013 19:57
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

Re: All notes off on button press question

Posted: 24 Oct 2013 01:47
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

Re: All notes off on button press question

Posted: 24 Oct 2013 02:15
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?

Re: All notes off on button press question

Posted: 24 Oct 2013 02:53
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 . .

Re: All notes off on button press question

Posted: 24 Oct 2013 14:59
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