Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arirusso/nibbler
Ruby MIDI message parser
https://github.com/arirusso/nibbler
midi midi-messages midi-parser music nibbles parser ruby
Last synced: about 1 month ago
JSON representation
Ruby MIDI message parser
- Host: GitHub
- URL: https://github.com/arirusso/nibbler
- Owner: arirusso
- License: other
- Created: 2011-04-28T15:03:33.000Z (over 13 years ago)
- Default Branch: main
- Last Pushed: 2023-02-05T22:20:49.000Z (almost 2 years ago)
- Last Synced: 2024-11-11T05:53:58.689Z (about 1 month ago)
- Topics: midi, midi-messages, midi-parser, music, nibbles, parser, ruby
- Language: Ruby
- Homepage:
- Size: 161 KB
- Stars: 21
- Watchers: 3
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nibbler
![nibbler](http://i.imgur.com/4BFZPJY.png)
Parse MIDI Messages
## Install
`gem install midi-nibbler`
or using Bundler, add this to your Gemfile
`gem 'midi-nibbler'`
## Usage
```ruby
require 'nibbler'nibbler = Nibbler.new
```Enter a MIDI message represented as string bytes
```ruby
nibbler.parse('904064')=> #
```Enter a message byte by byte
```ruby
nibbler.parse('90')
=> nilnibbler.parse('40')
=> nilnibbler.parse('64')
=> #
```Use numeric bytes
```ruby
nibbler.parse(0x90, 0x40, 0x64)
=> #
```You can enter nibbles in string format
```ruby
nibbler.parse('9', '0', '4', '0', '6', '4')
=> #
```Interchange the different types
```ruby
nibbler.parse('9', '0', 0x40, 100)
=> #
```Use running status
```ruby
nibbler.parse(0x40, 100)
=> #
```Look at the messages we've parsed so far
```ruby
nibbler.messages
=> [#
#]
```Add an incomplete message
```ruby
nibbler.parse('9')
nibbler.parse('40')
```See progress
```ruby
nibbler.buffer
=> ["9", "4", "0"]nibbler.buffer_s
=> "940"
```Pass in a timestamp
```ruby
nibbler.parse('904064', timestamp: Time.now.to_i)
=> { :messages=> #, :timestamp=>1304488440 }
```Nibbler defaults to generate [midi-message](http://github.com/arirusso/midi-message) objects, but it's also possible to use [midilib](https://github.com/jimm/midilib)
```ruby
Nibbler.new(message_lib: :midilib)nibbler.parse('9', '0', 0x40, '40')
=> "0: ch 00 on 40 40"
```## Also see
* [midi-eye](http://github.com/arirusso/midi-eye), a MIDI event listener based on nibbler
## Author
* [Ari Russo](http://github.com/arirusso)
## License
Apache 2.0, See the file LICENSE
Copyright (c) 2011-2022 Ari Russo