Page 1 of 1

Stuck midi notes; Maybe Ruby may fix it?

Posted: Thu Jan 22, 2015 5:11 pm
by kortezzzz
Its kinda old bug that never fixed: FS's midi inputs and modules doesn't support "All notes off" massage, so maybe there would be a Ruby alternative to add before the midi input prim' to kill sustained notes when switching between
midi inputs or changing midi pitches instantly? So far, couldn't find a solution for that with green :?

Re: Stuck midi notes; Maybe Ruby may fix it?

Posted: Thu Jan 22, 2015 7:03 pm
by KG_is_back
This has been discussed before. We have tried several approaches. One was, to send note-off massages to all notes, but that created massive CPU spike and even considerable LAG. Then I tried different approach - to save midi-number of notes that are on and delete them when they get off. Then a trigger input may be used to turn off all notes that are on.
At that time I was total noob at ruby, but now I made it in 5 minutes. Here's the code:

the module should have first input for midi in and second for a green trigger and one midi output. And also it doesn't pass midi through - you have to put it in parallel with your midi chain.

Code: Select all

def init
@notes=[]
end

def event i,v,t
#process incoming midi
if i==0
note=@ins[0].to_array
   #midi note on - save to array
   if note[0]==144
   @notes << [note[1],note[2]]
   end
   if note[0]==128
   @notes.delete([note[1],note[2]])
   end

end
#when all notes off trigger is received
if i==1
   @notes.each{|note|
#create new midi off message with respective channel and pitch
   out=Midi.new 128,note[0],note[1],100
   output 0,out,t
   }
   @notes=[]
end

end


Re: Stuck midi notes; Maybe Ruby may fix it?

Posted: Thu Jan 22, 2015 8:33 pm
by tulamide
Totally off-topic, but I just couldn't resist :lol:

kortezzzz wrote:..."All notes off" massage...

KG_is_back wrote:...send note-off massages to all notes...


You both are in such loving care for your notes! Yes, I heard that cows given a massage shall result in much more tasty steaks, but do notes really sound better after a massage? :mrgreen:

Re: Stuck midi notes; Maybe Ruby may fix it?

Posted: Thu Jan 22, 2015 9:41 pm
by KG_is_back
xD totally didn't noticed that :-D off course - everything and everyone sounds better after a massage...

Re: Stuck midi notes; Maybe Ruby may fix it?

Posted: Fri Jan 23, 2015 10:14 pm
by kortezzzz
:)

Well, I'm still getting never ending pampering massage from my stuck notes here... :lol: Maybe because they are
are scared to death from the option to be killed? Poor notes, they will do anything to survive :|

Unfortunately, your concept, @KG, doesn't works here. Tried to connect your code in so many ways without success. Thanks anyway.
Maybe we better forward another reminder to Malc? This bug probably should be fixed, not "bypassed".

Re: Stuck midi notes; Maybe Ruby may fix it?

Posted: Sat Jan 24, 2015 8:10 pm
by Nubeat7
works as suspected.. just add the module output to the desired midiconnection

but a note to malc to accept the "all notes off" message would be good, this really is a basic midi function which should work!

Re: Stuck midi notes; Maybe Ruby may fix it?

Posted: Mon Jan 26, 2015 9:54 am
by kortezzzz
Yes, it works now. Thanks guys. My problem was that when feeding few midi outputs with a midi input straight from a selector, its wasn't responding to change from 1 to 0. The "changed" primitive did the trick. :)