How to make a Panic Button (Send All MIDI Off)?
- 
 do you know how to generate a midi note off message? 
- 
 @Lindon Ah such a simple idea! 
- 
 @d-healey said in How to make a Panic Button (Send All MIDI Off)?: @Lindon Ah such a simple idea! thats me - full of simple ideas..... 
- 
 @Lindon Not really, only in conjunction with a Note On command 
- 
 @WillDevelop said in How to make a Panic Button (Send All MIDI Off)?: @Lindon Not really, only in conjunction with a Note On command so look in the documentation for NoteOff eventually` you will find: Synth.noteOff(int noteNumber)so ... for(i=0; i<128;i++) { Synth.noteOff(i); }
- 
 @Lindon 
 But does it also send a Note Off command to another plugin?
 Because the plugin does not generate its own sounds, but only outputs MIDI data.
- 
 @WillDevelop really, just type it in and try it.. if not - then you have learned something. 
- 
 @Lindon Okay, I tried it and it didn't work. 
- 
 I have found a solution Button Callback if(isMidiPanicBtnActive == 0) { isMidiPanicBtnActive = button.getValue; button.setValue(0); }onNoteOff Callback if (isMidiPanicBtnActive == 1) { for(i=0; i<128; i++) { Message.setNoteNumber(i); Message.sendToMidiOut(); } isMidiPanicBtnActive = 0; }The only downside of this solution is that you have to press the button and then press a midi key 
 Because I don't think it is possible to send a message command with a button click, at least not "Message.setNoteNumber()"
- 
 I know you guys are always looking at the “coding” way to do this…but wouldn’t a simple “no code” way to do this be to just create a button…make it momentary and assign it to the project master bypass? Because doesn’t that send an “All notes off” message that kills any midi/audio playing? 
- 
 @johnmike that would be a much simpler solution, but I found nothing in the documentation about project master bypass. 
- 
 That would just bypass your plugin, it wouldn't send MIDI out. 
- 
 The proper solution would be adding a sendToMidiOut()to the MessageHolder API object, then you can call this from anywhere. But it's a sensible request, I just didn't use the MIDI out functionality myself too much in order to need it.
- 
 @Christoph-Hart Would it be possible to add a more generic midi out that allows to send artificial events too? 
- 
 @d-healey sure, the idea would be that you can send any message type like this. 
- 
 Gotcha...def the scripting stuff for sending midi out to other plugins...but as far as just creating a generic "Panic" button this is what I was talking about...just for the guys and gals that are trying to accomplish a simple task of creating a simple "Panic" button...WARNING turn speakers down for the audio example... https://www.dropbox.com/scl/fi/98yaqpt73ok0gvc8y200m/Panic.mov?rlkey=89m091do482lpbo5kwf62yjza&dl=0 
- 
 @Christoph-Hart said in How to make a Panic Button (Send All MIDI Off)?: sendToMidiOut That's a good suggestion, but when trying around with the MessageHolder object I noticed that the object does not have the function sendToMidiOut() at all and if I understand correctly sendToMidiOut() only works in the Midi callbacks, which is only triggered when a Midi signal comes in 
- 
 @WillDevelop Christoph is saying he needs to add this functionality to HISE, it isn't there yet 
- 
 @d-healey Okay, my bad. 
 I have now solved the problem like this:
 When you press the panic button you have one second to press any MIDI note so it can send a note off command to the next plugin for each note.Here is the code for it onInit() // MIDI Panic Btn const midiPanicBtn = Content.addButton("midiPanicBtn").setPosition(204, 40, 70, 43); var isMidiPanicBtnActive = midiPanicBtn.getValue; // MIDI Panic Btn Timer const midiPanicBtn_timer = Engine.createTimerObject(); midiPanicBtn_timer.setTimerCallback(function(){ var panicBtn = Content.getComponent("midiPanicBtn"); isMidiPanicBtnActive = 0; midiPanicBtn_timer.stopTimer(); });Button-Callback if(isMidiPanicBtnActive == 0) { isMidiPanicBtnActive = 1; midiPanicBtn_timer.startTimer(1000); }onNoteOff() if (isMidiPanicBtnActive == 1) { for(i=0; i<128; i++) { Console.print(i); Message.setNoteNumber(i); Message.sendToMidiOut(); } }Thank you all for helping me! 
- 
W WillDevelop has marked this topic as solved on
- 
 @WillDevelop said in How to make a Panic Button (Send All MIDI Off)?: var isMidiPanicBtnActive = midiPanicBtn.getValue; Check this...