CHORDPLAYER.JS
Installation:
You may import the code into an existing node.js project or import it directly into your HTML code
# local install to your project
npm install --save-dev chordplayer
var cp = require('chordplayer')
<script type="text/javascript" src="chordPlayer.min.js"></script>
<script type="text/javascript" src="chordPlayer.js"></script>
The module is instanciated in the object cp, which you can use right away
cp.buildChordPlayer("Cmin7b5").play()
Constructors
There are several ways to instanciate the class:
buildChordPlayer(chordName,[audioContext])
Builds a chordPlayer from a specific name.
audioContext is created if not provided.
c = cp.buildChordPlayer("Cmin7b5");
c = cp.buildChordPlayer("Cdim");
c = cp.buildChordPlayer("A#maj");
c = cp.buildChordPlayer("Bbmaj");
Methods
-
play([callback])
Plays the chord
c = cp.buildChordPlayer("Amaj")
c.play(function(){
console.log("end play")
})
cp.buildChordPlayer("Bbmaj").getChordInfo()
Setters:
setAudioContext(audioContext)
setDestinationNode(node)
setDuration(duration)
setOctave(octaveNb)
setVolume(volume)