0.1.0 • Published 10 years ago
rites v0.1.0
Rites - Musical scales and tunings library
Installation
npm install ritesExample
var scale = new rites.scale.Major();
// The third degree of a major scale with root frequency at low C (65.406Hz),
// in the second octave i.e. bass E.
scale.getFrequency(2, 65.406, 1);API Documentation
Scales
Scale
new rites.scale.Scale(degrees, [tuning=new rites.tuning.EqualTemperament(12)]);Representation of a generic musical scale. Can be subclassed to produce specific scales.
Parameters:
- degrees -
Number[]- Array of integer degrees - tuning -
Tuning- The scale's tuning. Defaults to 12-tone ET.
rites.scale.Scale.prototype.getFrequency(degree, rootFrequency, octave);Get the frequency of a note in the scale.
Parameters:
- degree -
Number- The note's degree. - rootFrequency -
Number- The root frequency of the scale. - octave -
Number- The octave of the note.
Returns:
Number - The frequency of the note in hz.
Major
new rites.scale.Major();Major scale.
Extends:
rites.scale.Scale
Major
new rites.scale.Minor();Representation of a generic musical tuning. Can be subclassed to produce specific tunings.
Tunings
Tuning
new rites.tuning.Tuning(semitones, [octaveRatio=2]);Parameters:
- semitones -
Number[]- Array of semitone values for the tuning. - octaveRatio -
Number- Frequency ratio for notes an octave apart.
EqualTemperamentTuning
new rites.tuning.EqualTemperament(pitchesPerOctave);Extends:
rites.scale.Scale
Parameters:
- pitchesPerOctave -
NumberThe number of notes in each octave.
0.1.0
10 years ago