Giter Club home page Giter Club logo

modern-midi's Introduction

ModernMIDI

ModernMIDI brings together a number of support classes to read, manipulate, and generate MIDI data. For realtime input/output, the library gently wraps RtMidi for cross-platform hardware IO. Furthermore, ModernMIDI includes a comprehensive file io module for reading and writing format-0 files. Other features include common music theory concepts expessed in MIDI, along with a decently performing real-time file player. It's currently thin on the example/documentation front, but more samples will be forthcoming.

In various forms, it has been used in performances with the Seattle Symphony, installations at the Jewish Contemporary Museum in SF, and in many smaller Arduino prototypes in conjunction with HIDUINO.

This code is functional but rarely maintained. For a newer take on midi library support in C++, see RtMidi17.

Building / Usage

To run the included exampes, use the included VS2013 or XCode 6 projects. ModernMIDI will build on any platform with a recent C++11 compiler. At present, ModernMIDI is not packaged into a static or dynamic library -- instead, the usage model is that developers will compile the small number of files directly into a new project.

ModernMIDI inherits from the linkage requirements of RtMidi. RtMidi needs a preprocessor macro defined in the project configuration to select the correct backend (e.g. __MACOSX_CORE__). On OSX the following frameworks must be included in a project: CoreAudio.framework, CoreMIDI.framework, and CoreFoundation.framework. On Windows, winmm.lib must be included although this is automatically handled in modernmidi.h.

Acknowledgements

ModernMIDI is a continuation of the functionality developed in LabMIDI by @meshula.

License

ModernMIDI is released under the simplified BSD 2-clause license. See the COPYING file for more information on the (license-compatible) third party code included within ModernMIDI.

modern-midi's People

Contributors

ddiakopoulos avatar vethanis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

modern-midi's Issues

Link NoteOn/Note Off

When reading/writing files, it's nice to have a garantee that note on messages can be matched with note offs. Optional function to generate note offs for hanging note ons, and deleting note offs for ghost note on messages.

Bug when parsing midi with running status

Hello,
so, I'm working on a fork of this lib & rtmidi (https://github.com/jcelerier/RtMidi17), but I found a bug when parsing midi files with running status so it may be of interest for you :

here: https://github.com/ddiakopoulos/ModernMIDI/blob/master/src/midi_file_reader.cpp#L160

say that you have for instance the following midi bytes sequence:

 00 99 23 50 00 31 50 77 23 00
|-----------|--------|--------|
      1          2       3

1 is a note on, channel 10, note 35, velocity 80
2 is a note on, channel 10, note 49, velocity 80
3 is a note on, channel 10, note 35, velocity 0 which starts a bit later

now, after parsing the first note:

  • parseEvent is called with dataStart pointing on the second byte of 2 (0x31) since it's the first bit of the midi channel event
  • type = *dataStart++, hence dataStart points on the third byte of 2 (0x50) and type == 0x31
  • we enter the running status check :
if (((uint8_t) type & 0x80) == 0) 
{
  event->m->data[0] = (uint8_t) type;
  type = lastEventTypeByte;
}

after this, the data stored in the event looks like :

[31, 00, 00]

-> the type is wrong, and event->m->data[1] is never set !

Instead, it should be :

if (((uint8_t) type & 0x80) == 0)
{
  event->m->data[0] = (uint8_t) lastEventTypeByte;
  event->m->data[1] = (uint8_t) type;
  type = lastEventTypeByte;
}

after which the data looks like

[99, 31, 00]

and the switch can work correctly afterwards

API Pain Points

msg1.getMessageType() == (uint8_t) MessageType::NOTE_OFF : remove the need to cast MessageType to a uint8_t

Better document + provide helper functions for parsing data in MetaData messages (like tempo or time signature). Right now, there is an example of how to get at the data in sample.cpp, but it is not ideal.

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.