midiname

part of wslib


notenumber to notename and backwards conversion

also includes convenience methods for frequency (cps)


midivoicetype can be used to test if a certain note 

or frequency is included in a certain voice type


voice types are currently in english and dutch


note names are as found in Logic Pro. Sibelius and some other brands

use other:  C4 in Logic = C3 in Sibelius



SimpleNumber-midiname ( sign )

convert a midi notenumber to a notename

adds a 'cents' method


64.midiname; // -> "E3"


SimpleNumber-cpsname ( sign )

convert frequency to a notename


440.cpsname; // -> "A3"


String-namemidi ( cents )

convert a notename to a midi notenumber


"G2".namemidi; // -> 55


String-namecps ( cents )

convert a notename to a frequency


"A2".namecps; // -> 220


String-namename ( cents, sign )

convert a notename to a standardized notename


"A#2".namename; // -> "Bb2"


Convenience methods for Symbol and Array classes were added.


scales


makeScale ( type, startNote, endNote )


Makes a scale using the object it's called to as ground note. If no endNote or startNote is provided, the scale will range from the ground note to an octave higher. 


When called on a Number, the number is used as a midi note number. 

When called on a String or Symbol, it is interpreted as a note name, and the result will also contain notenames.


Possible scale types:


arabic

blues

blues-major

chromatic

fifth

fifth-major

fifth-minor

harm-minor

indian

just

just-major

just-minor

major

melo-minor

minor

pentatonic

pythagorean

quartertones

werckmeister


60.makeScale( \just );

"G4".makeScale( \major );



voicetype


tests if a note is within reach of singing voices



SimpleNumber-midivoicetype ( type, language )

get the voicetypes who can sing this midi notenumber

type can be nil, 'm' or 'f' (male or female)

language can be 'en' or 'nl' (English - default - or Dutch )


Returns an array of possible voice types. If a voice type is followed by a - or + sign that means it is in the outer regions, and can probably only be sung by well-trained singers, and not for a long time.


42.midivoicetype;  // -> [ 'baritone -', 'bass' ]

SimpleNumber-cpsvoicetype

get the voicetypes who can sing this frequency


String-namevoicetype ( type, language )

get the voicetypes who can sing this notename