Page 1 of 2
Process MIDI data?
Posted: Wed Dec 24, 2014 5:37 pm
by daslicht
Hi,
is it possible to craete a Plugin (vst instrument) which i can load on a instruemnt track in studio one which
limits the incoming velocity values eg by 80 to 100? and outputs it to another instrument track, please?
Or is therer maybe something ready like this?
Re: Process MIDI data?
Posted: Wed Dec 24, 2014 7:12 pm
by KG_is_back
Midi can easily be processed with ruby component. Following code will do the job:
3 inputs are required: midi in, integer for min, integer for max and midi output.
Code: Select all
def event i,v,t
note=@ins[0].to_array
if note[0]==144 #if note-on massage
note[3]=[[@ins[1],note[3]].max,@ins[2]].min
end
note=Midi.new(note[0],note[1],note[2],note[3])
output 0,note,t
end
In order for it to work, you just create module with this ruby component inside and put midi input and output to it. VST plugin must also have one or two mono inputs and outputs in order to be valid VST.
Your DAW should have a way to route midi into the effect and out of it. I'm not familiar with Studio One, but it's possible in FL studio and Cubase as far as I know.
Re: Process MIDI data?
Posted: Thu Dec 25, 2014 2:50 pm
by daslicht
Thank you ,
I set it up as you described, but the forwared notes seam not to have a note off ?
I just get hung notes.?
Re: Process MIDI data?
Posted: Thu Dec 25, 2014 3:06 pm
by daslicht
I added a fader as int source, but now when i move teh fade it will also send notes:) Thats teh source of teh hung note
I keep fiddeling

Re: Process MIDI data?
Posted: Thu Dec 25, 2014 3:35 pm
by daslicht
How do I just craete notes when the input came from teh midi in and not when something is coming in the 2 other inputs, please?
Re: Process MIDI data?
Posted: Thu Dec 25, 2014 7:10 pm
by oddson
daslicht wrote:...I just get hung notes.?
If you limit the minimum value you will get hung notes if your keyboard uses note-on with velocity=0 in place of note-off messages (which many seem to do).
daslicht wrote:How do I just create notes when the input came from the midi in and not when something is coming in the 2 other inputs, please?
Do you mean physical inputs form the external device you're filtering with Flowstone - you'd have to make sure they're coming in on different MIDI channels and make the code sensitive to that.
Before Ruby, Flowstone (and it predecessor SynthMaker) could do this sort of processing with a MIDI splitter and MIDI event primitives and in conjunction with math and logic components without having to code.
While these can be easy to understand when simple they can get pretty messy once you start including complex behaviour.
This module would pass everything except channel 2 note-on messages unaffected and limit velocity on channel 2 note-on messages to 100.
Re: Process MIDI data?
Posted: Thu Dec 25, 2014 7:39 pm
by daslicht
oddson wrote:If you limit the minimum value you will get hung notes if your keyboard uses note-on with velocity=0 in place of note-off messages (which many seem to do).
Yeh looks like my controler do not send NoteOff values
I am using Abpletonb Push + PXT General via MIDI Loop
oddson wrote:eDo you mean physical inputs form the external device you're filtering with Flowstone - you'd have to make sure they're coming in on different MIDI channels and make the code sensitive to that.
?
By inputs i was refering to the script above wihc has 3 inputs: midi, int1, int2
Code: Select all
def event i,v,t
note=@ins[0].to_array
if note[0]==144 #if note-on massage
note[3]=[[@ins[1],note[3]].max,@ins[2]].min
note=Midi.new(note[0],note[1],note[2],note[3])
output 0,note,t
end
end
Re: Process MIDI data?
Posted: Thu Dec 25, 2014 7:55 pm
by daslicht
Ok hung notes are solved at least when playing, but when I move slider 1 the else branch is fired.
so essential I am looking for something like :
Code: Select all
if some value comes from input 1 or 2 (0 is the midi input) do not fire any midi event
idea?
seeL:
http://i.imgur.com/2pKcVlR.pngCode: Select all
def event i,v,t
note=@ins[0].to_array
min = 50
max = 100
watch @ins[1]
if note[0]==144 && note[3] > 0 #if note-on massage
#note[3]=[[@ins[1],note[3]].max,@ins[2]].min
note=Midi.new(144,note[1],note[2],100)
output 0,note,t
else
note=Midi.new(128,note[1],note[2],100)
output 0,note,t
end
end
Re: Process MIDI data?
Posted: Thu Dec 25, 2014 8:42 pm
by tulamide
Code: Select all
def event i,v,t
if i != 1 && i != 2 ### i tells either the name or the index of the input ###
### that fired the event. Alternatively you could set ###
### 'if i == 0', but I followed exactly what you wrote ###
note = v.to_array if v != nil
if note[0] == 144
if note[3] > 0
note=Midi.new(144,note[1],note[2],100)
else
note=Midi.new(128,note[1],note[2],100)
end
output 0,note,t
end
end
end
Re: Process MIDI data?
Posted: Thu Dec 25, 2014 8:57 pm
by tulamide
oddson wrote:This module would pass everything except channel 2 note-on messages unaffected and limit velocity on channel 2 note-on messages to 100.
Clean and easy-to-follow green solution. Good job!