arirusso / unimidi

Realtime MIDI IO for Ruby
Other
255 stars 28 forks source link

question about receive midi #25

Closed michelson closed 9 years ago

michelson commented 10 years ago

Hi @arirusso ,

This library is really cool!! I´been playing with unimidi and I would like to ask you a question regarding the midi receive.

In My script , after device selection , there is a loop which receives the midi, then the data is sent over osc connection to another place.

the code is something like this:

    input = UniMIDI::Input[device_index]
    puts "selected #{device_index}"
    input.open do |input|
      $stdout.puts "send some MIDI to your input now..."
      loop do
        m = input.gets
        @osc_client.send_data(@chan, m)
        $stdout.puts(m)
      end
    end 

the @osc_client.send_data(@chan, m) method receives data from the midi input , like this .... {:data=>[144, 60, 80], :timestamp=>393315.1948451996} .... {:data=>[128, 60, 64], :timestamp=>394523.4229564667} ..... .... {:data=>[144, 60, 76], :timestamp=>393315.1948451996} .... {:data=>[128, 60, 64], :timestamp=>394523.4229564667} ..... If you look at the data: key of the hash you will note that never receives a 0 value (at last index ), instead it always back to 64 as a Note Off , I guess, event.

the NoteOff is expresed as value 64 of the array ?

I´ve made tests in PureData, and MaxMSP and the data I get is [128, 60, 0] when note off.

Best ,

arirusso commented 10 years ago

Thank you!

What OS, ruby version and midi interface are you using?

It does seem like a bug. And I'll look into fixing it.

But....it shouldn't matter for what you're doing. No matter what the last value of the array is that message is still Note Off because the first value is 128. The last value in the array is velocity. Velocity for Note Off events has largely been disregarded unless you're using it for some custom purpose.

michelson commented 10 years ago

Hi Ari

im using OSX, ruby 2.0 and 1.9.3, and a nanokey2 korg keyboard.

I´ll check the 128 value then as a NoteOff, I hope can try this today at afternoon

I will look forward for any updates on this,

thanks in advance

best

Atte. Miguel Michelson Martinez www.artenlinea.com

On Mon, Nov 11, 2013 at 1:18 PM, Ari Russo notifications@github.com wrote:

Thank you!

What OS, ruby version and midi interface are you using?

It does seem like a bug. And I'll look into fixing it.

But....it shouldn't matter for what you're doing. No matter what the last value of the array is that message is still Note Off because the first value is 128. The last value in the array is velocity. Velocity for Note Off events has largely been disregarded unless you're using it for some custom purpose.

— Reply to this email directly or view it on GitHubhttps://github.com/arirusso/unimidi/issues/25#issuecomment-28213497 .

arirusso commented 9 years ago

I've tested on a similar setup (now with Ruby 2.1.1) and I can't recreate the problem. I wonder if it has to do with MIDI running status perhaps.

Hopefully it hasn't been a problem for you