Giter Site home page Giter Site logo

purescript-midi's Introduction

purescript-midi

Build Status

Latest release

MIDI support in the browser.

This library allows you to both parse and generate MIDI event streams and MIDI recordings. It also allows you to connect to a MIDI instrument (such as a keyboard) via the Web MIDI API. For example, if you use Chrome and can plug in a MIDI keyboard you should to be able to play it using this demonstration.

To parse a MIDI string that represents a recording and thus generate a value of type Midi.Recording you can use:

(parse <<< normalise) midiString

On the other hand, you may merely need to parse MIDI events (such as note on or note off) that emanate from a Web MIDI connection. In other words, you are connecting directly to a MIDI device through the browser and need to parse the stream of event messages as the instrument is played. To do this, use:

parseMidiEvent midiEvent

This will attempt to parse an individual event.

To Build

npm run build 

To Test

npm run test

Web MIDI Permissions

It appears that browsers are becoming stricter about allowing Web MIDI to run from 'untrusted' servers after being notified of security exploits. At the time of writing, both Chrome (see details) and Mozilla require HTTPS connections.

Module documentation

Module documentation is published on Pursuit.

purescript-midi's People

Contributors

newlandsvalley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

i-am-the-slime

purescript-midi's Issues

File and event parsing is subtly different

In that SysEx messages appear to have a different format within a file from that in an event stream. From p135 in the MIDI spec:

For instance, the transmitted message F0 43 12 00 07 F7 would be stored in a MIDI file as F0 05 43 12 00 07 F7.

Again discovered by @rhofour against the Elm implementation. Unfortunately this means that it will require separate implementations of all event parsing.

Rename Instruments.instruments

Probably best just to call this just names and rename the existing function that is called names (and is not exported) to namesMap.

Upgrade to Signal

The FFI interface (for Web-Midi) is completely new in the latest AFF

Parsing messages from node-midi

Hi! I'm writing a library to talk with node-midi, and I'd like to integrate it with this library, i.e. possibly reuse the datatypes and the parser, etc.

I'm opening this issue because I'm not sure how to make the parser work on the events that I get from the Node library, which are JS arrays. E.g. a NoteOn would be something like [144, 89, 127].

Is this possible right now, or would it require a patch?

Amend the Playable typeclass

The definition is suitable for MIDI melodies but not for other sources which may need to look up MIDI note channels from instrument soundfonts that are in scope. (This is the case with PSoM melodies for example).

Generated code for Midi.Instruments is grossly inflated

This is because we have a very large enumerated type for the (128) MIDI instrument names. The problem comes if we want to automatically generate an Ord instance - the code bloat goes through the roof.

The answer seems to be to write an Ord instance by hand by just comparing the stringified version of the names.

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.