scop

0.2.2 • Public • Published

scop Build Status Dependency Status

Library for the scopitone workshop

Usage

  • install with npm install scop --save
  • check the demo sample:
var Scop = require('scop').Scop,
    Notes = require('scop').Notes,
    // new instance of the arduino controler
    scop = new Scop('/dev/ttyACM0');
 
// bpm and sequence to be played
var bpm = 180;
var seq = [
    {id: Notes.A},
    {id: Notes.A},
    {id: Notes.A},
    {id: Notes.B},
    {id: Notes.C},
    {id: Notes.B, duration: Notes.blanche},
    {id: Notes.A, duration: Notes.blanche},
    {id: Notes.C},
    {id: Notes.B},
    {id: Notes.B},
    {id: Notes.A}
];
 
// only start playing when the serial port is open
scop.on('ready', function() {
    // play the sequence at the defined bpm
    scop.play(seq, bpm);
    // loop the sequence after a 1s pause
    scop.on('played', function() {
        setTimeout(function() {
            scop.play(seq, bpm);
        }, 1000);
    });
});

API

Scop()

A class that instanciate a serial port communication with the arduino. When the serial port is opened, it sends a 'ready' event.

Scop.play(sequence:Array, bpm:Number)

Play sequentially the motors. The sequence provided is an array of numbers. Each of this numbers corresponds to a combination of motors to play during the measure. If you put a 0 (or scop.none) on the array it means no motor will be played during the measure. When the sequence is finished, an event is sent.

Notes

Motor combinations representing notes and chords. And note durations

Dependencies (3)

Dev Dependencies (6)

Package Sidebar

Install

npm i scop

Weekly Downloads

5

Version

0.2.2

License

MIT

Last publish

Collaborators

  • xavier.seignard