Giter Site home page Giter Site logo

bitzky / midi-visualizer-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thomascastleman/midi-visualizer-framework

0.0 0.0 0.0 20 KB

A generalized framework that can be used to easily create visualizations of MIDI input using Processing and the Midibus library

License: MIT License

Processing 100.00%

midi-visualizer-framework's Introduction

midi-visualizer-framework

A generalized framework that can be used to easily create visualizations of MIDI input using Processing and the Midibus library.

Purpose

When using input from a MIDI instrument in Processing, issues may arise with the handling of new notes as they arrive and old notes as they are released. This framework is designed to streamline the process of managing a list of active note objects, adding new ones and removing old ones as they come without throwing any Concurrent Modification Exceptions. The handling of this process frees up the developer to focus more on the creative aspects of the software they are writing.

Overview

The code for handling note tracking is packaged into the NoteManager class. The NoteManager assumes the existence of a Note class (as outlined in Note.pde) which has at least the following attributes and functions:

  int lifespan;                   // lifespan of note, in frames
  boolean isReleased;             // whether or not the note has been released yet
  void update()                   // updates something about the properties of the Note object
  void display()                  // generates a visual representation of the note

The specific implementation of this class is up to the developer, however. As soon as the isReleased flag becomes true, the NoteManager begins to decrement the lifespan of a note. This by default happens when a note is released, however the flag could be made true earlier if desired.

The NoteManager itself has a few key functions which are of use to the developer:

void addNote(Note n)

This adds a new Note object to be tracked. Likely called every time a noteOn is received.

void releaseNote(Note n)

This will release the Note object with the same specifications as the given Note n from being tracked. Likely called every time a noteOff is received.

void track()

This function, which should be run every iteration of the draw() loop, tells the NoteManager to start tracking all the notes that were pressed since the last iteration of draw(), and to stop tracking any of the notes that have since been released. It also calls update() and then display() on every note currently being tracked.

At any given point in the tracking, an ArrayList of the Note objects currently being tracked is stored under NoteManager.notes.

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.