Needlessly Postulating Minds
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    scoppublic

    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

    Keywords

    none

    install

    npm i scop

    Downloadsweekly downloads

    25

    version

    0.2.2

    license

    none

    repository

    githubgithub

    last publish

    collaborators

    • avatar