0.01
No release in over 3 years
Low commit activity in last 3 years
A utility for parsing MIDI messages from various types of input
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.0.4, ~> 2.0
>= 5.5.0, ~> 5.5
>= 1.1.0, ~> 1.1
>= 10.4.2, ~> 10.4
>= 1.2.1, ~> 1.2

Runtime

>= 0.4.4, ~> 0.4
 Project Readme

Nibbler

nibbler

Parse MIDI Messages

Install

gem install midi-nibbler

or using Bundler, add this to your Gemfile

gem 'midi-nibbler'

Usage

require 'nibbler'

nibbler = Nibbler.new

Enter a MIDI message represented as string bytes

nibbler.parse('904064')

  => #<MIDIMessage::NoteOn:0x98c9818
        @channel=0,
        @data=[64, 100],
        @name="C3",
        @note=64,
        @status=[9, 0],
        @velocity=100,
        @verbose_name="Note On: C3">

Enter a message byte by byte

nibbler.parse('90')
  => nil

nibbler.parse('40')
  => nil

nibbler.parse('64')
  => #<MIDIMessage::NoteOn:0x98c9818
       @channel=0,
       @data=[64, 100],
       @name="C3",
       @note=64,
       @status=[9, 0],
       @velocity=100,
       @verbose_name="Note On: C3">

Use numeric bytes

nibbler.parse(0x90, 0x40, 0x64)
  => #<MIDIMessage::NoteOn:0x98c9818 ...>

You can enter nibbles in string format

nibbler.parse('9', '0', '4', '0', '6', '4')
  => #<MIDIMessage::NoteOn:0x98c9818 ...>

Interchange the different types

nibbler.parse('9', '0', 0x40, 100)
  => #<MIDIMessage::NoteOn:0x98c9818 ...>

Use running status

nibbler.parse(0x40, 100)
  => #<MIDIMessage::NoteOn:0x98c9818 ...>

Look at the messages we've parsed so far

nibbler.messages
  => [#<MIDIMessage::NoteOn:0x98c9804 ...>
      #<MIDIMessage::NoteOn:0x98c9811 ...>]

Add an incomplete message

nibbler.parse('9')
nibbler.parse('40')

See progress

nibbler.buffer
  => ["9", "4", "0"]

nibbler.buffer_s
  => "940"

Pass in a timestamp

nibbler.parse('904064', timestamp: Time.now.to_i)
  => { :messages=> #<MIDIMessage::NoteOn:0x92f4564 ..>, :timestamp=>1304488440 }

Nibbler defaults to generate midi-message objects, but it's also possible to use midilib

Nibbler.new(message_lib: :midilib)

nibbler.parse('9', '0', 0x40, '40')
  => "0: ch 00 on 40 40"

Also see

  • midi-eye, a MIDI event listener based on nibbler

Author

License

Apache 2.0, See the file LICENSE

Copyright (c) 2011-2022 Ari Russo