Git Product home page Git Product logo

nibbler's Introduction

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

nibbler's People

Contributors

arirusso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.