CHORDPLAYER.JS
Installation:
You may import the code into an existing node.js project or import it directly into your HTML code
- Node module import
# local install to your project npm install --save-dev chordplayer
// import module into your js codevar cp =
- plain JS import
<!-- minified version, not human friendly, 56kb--><!-- uncompressed version, human friendly, 418kb -->
The module is instanciated in the object cp, which you can use right away
cp
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; //will return a chord with 4 notes ("C", "D#", "F#", "A#")c = cp; //will return a chord with 3 notes ("C", "D#", "F#")c = cp; //will return a chord with 3 notes ("A#", "D", "F")c = cp; //will return a chord with 3 notes ("A#", "D", "F")
Methods
-
play([callback])
Plays the chord
c = cpc
-
getChordInfo()
Returns the notes present in the chord
cp
Setters:
setAudioContext(audioContext)
setDestinationNode(node)
setDuration(duration)
setOctave(octaveNb)
setVolume(volume)