Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

midi-nibbler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

midi-nibbler

  • 0.2.4
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

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 message piece by piece

nibbler.parse("90")
  => nil

nibbler.parse("40")
  => nil

nibbler.parse("40")
  => #<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 all at once

nibbler.parse("904040")

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

Use bytes

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

You can use nibbles in string format

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

Interchange the different types

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

Use running status

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

Look at the messages we've parsed

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("904040", :timestamp => Time.now.to_i)
  => { :messages=> #<MIDIMessage::NoteOn:0x92f4564 ..>, :timestamp=>1304488440 }

Nibbler defaults to generate midi-message objects, but it is 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-2015 Ari Russo

FAQs

Package last updated on 16 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc