Wednesday, August 31, 2011

MicroMIDI: MIDI Thru and Processing

The simplest way to work with MIDI input in MicroMIDI is to use its built-in shortcuts for MIDI Thru and processor classes.

Here's an example where both kinds of shortcuts are used. An input and output are passed in, all messages that are received by the input are sent to the output (Thru) with the exception of notes which will be transposed up one octave before being sent to the output. The transpose function is an example of a processor.
@i = UniMIDI::Input.use(:first)
@o = UniMIDI::Output.use(:first)

MIDI.using(@i, @o) do

  thru_except :note { |msg| transpose(msg, :octave, 1) }

  join

end

http://github.com/arirusso/micromidi

Next: Custom Events with MicroMIDI

1 comment:

  1. Hello,
    I am trying this on Windows with Ruby 1.9.3p392.

    I can't get past the selection of my MIDI input:

    You may have encountered a bug in the Ruby interpreter or extension libraries.
    Bug reports are welcome.
    For details: http://www.ruby-lang.org/bugreport.html


    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.
    --
    There are PLENTY of other logs, also. If it can help I would happily send them to you via any form you prefer.
    Many thanks!

    ReplyDelete