GithubHelp home page GithubHelp logo

scribe's Introduction

Scribe

Scribe makes it easy to write music on the web.

Scribe turns an array of notes and chords into music notation that is rendered in SVG.

Scribe(svg, data, options)

svg

Either an id (string) of an SVG node, or an SVG node.

data

An array of notes and chords. For example:

[
    [2,   0.5, 'note', 76],
    [2.5, 0.5, 'note', 77],
    [3,   0.5, 'note', 79],
    [3.5, 3.5, 'note', 74]
]

Renders as:

Dum-de-de-duuum

That's right. You only need to give it the notes. Scribe interprets the notes and writes out the notation with rests and ties in place.

A note array contains four values: the type string 'note', the beat, note number and duration. The beat is the time the note starts expressed in quarter notes. The note number is an integer 0-127 that corresponds to MIDI note number. The duration is time the note is held expressed in quarter notes.

Note that it's early days, and the required format of this note data may change.

options

Scribe's rendered notation can be modified with these optionally optional options:

{
    clef: 'treble',
    clefOnEveryStave: false,
    barsPerStave: 4,
    
    paddingTop: 12,
    paddingLeft: 3,
    paddingRight: 3,
    paddingBottom: 6,
    staveSpacing: 24,
    
    start: 0,
    end: undefined,
    
    key: 'C',
    transpose: 0,

    beamBreaksAtRest: true,
    beamGradientMax: 0.25,
    beamGradientFactor: 0.25
}

The units for padding and spacing are kind of arbitrary. 1 unit is the distance from a stave line to the center of a stave space. In other words, a stave is 8 units high.

Features

Scribe is new. Some features I intend to implement:

  • Key centre analysis, for identifying the key centre of individual phrases (very difficult).
  • Multi-stave rendering, for piano or multi-part scores (moderately challenging).
  • Live data binding, so that Scribe will automatically show changes in data (piece of piss).

If you like scribe and are interested in helping, please fork and let me know what you might work on.

Contributions

Rich Sigler of Sigler Music Fonts (http://www.jazzfont.com/) very kindly granted permission to use JazzFont shapes as SVG paths. If you use Scribe a lot, please consider buying a JazzFont license (http://www.jazzfont.com/order.html).

Gavin Band (@gavmotron) implemented probabalistic key centre analysis using a Hidden Markov Model.

scribe's People

Contributors

stephband avatar

Watchers

Òscar Vilaplana avatar James Cloos avatar

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.