Packageorg.si.sion.utils
Classpublic class Scale
InheritanceScale Inheritance Object
Subclasses Chord

Scale class.



Public Properties
 PropertyDefined By
  bassNote : int
bass note number
Scale
  centerOctave : int
center octave
Scale
  name : String
Scale name.
Scale
  rootNote : int
root note number
Scale
Protected Properties
 PropertyDefined By
  _defaultCenterOctave : int
default center octave, this apply when there are no octave specification.
Scale
  _noteNames : Array
[static] note names
Scale
  _scaleName : String
scale name
Scale
  _scaleNotes : Vector.<int>
notes on the scale
Scale
  _scaleTable : int
scale table
Scale
  _scaleTableDictionary : *
[static] scale table dictionary
Scale
  _tensionNotes : Vector.<int>
notes on 1octave upper scale
Scale
Public Methods
 MethodDefined By
  
Scale(scaleName:String, defaultCenterOctave:int = 5)
constructor
Scale
  
check(note:int):Boolean
check note availability on this scale.
Scale
  
copy from another scale
Scale
  
getNote(index:int):int
get note by index on this scale.
Scale
  
getScaleIndex(note:int):int
get scale index from note.
Scale
  
setScaleTable(name:String, rootNote:int, table:Array):void
set scale table manualy.
Scale
  
shift(note:int):int
shift note to the nearest note on this scale.
Scale
Protected Methods
 MethodDefined By
  
_errorInvalidScaleName(name:String):Error
Invalid scale name error
Scale
Protected Constants
 ConstantDefined By
  ST_BLUE_NOTE : int = 0x14e94e9
[static] Scale table of Cb
Scale
  ST_CHROMATIC : int = 0x1ffffff
[static] Scale table of Cc
Scale
  ST_COMB_DIMINISH : int = 0x16db6db
[static] Scale table of Ccd
Scale
  ST_DIMINISH : int = 0x1249249
[static] Scale table of Cd
Scale
  ST_DORIAN : int = 0x16ad6ad
[static] Scale table of Cdor
Scale
  ST_DPERFECT : int = 0x14a14a1
[static] Scale table of Csus47
Scale
  ST_GYPSY : int = 0x19b39b3
[static] Scale table of Cgyp
Scale
  ST_HANGARIAN : int = 0x1acdacd
[static] Scale table of Chan
Scale
  ST_HARMONIC_MINOR : int = 0x19ad9ad
[static] Scale table of Chm
Scale
  ST_JAPANESE : int = 0x14a54a5
[static] Scale table of Cjap
Scale
  ST_LOCRIAN : int = 0x156b56b
[static] Scale table of Cloc
Scale
  ST_LYDIAN : int = 0x1ad5ad5
[static] Scale table of Clyd
Scale
  ST_MAJOR : int = 0x1ab5ab5
[static] Scale table of C
Scale
  ST_MELODIC_MINOR : int = 0x1aadaad
[static] Scale table of Cmm
Scale
  ST_MINOR : int = 0x15ad5ad
[static] Scale table of Cm
Scale
  ST_MINOR_PENTATONIC : int = 0x14a94a9
[static] Scale table of Cmp
Scale
  ST_MIXOLYDIAN : int = 0x16b56b5
[static] Scale table of Cmix
Scale
  ST_PENTATONIC : int = 0x1295295
[static] Scale table of Cp
Scale
  ST_PERFECT : int = 0x10a10a1
[static] Scale table of Csus4
Scale
  ST_PHRIGIAN : int = 0x15ab5ab
[static] Scale table of Cphr
Scale
  ST_POWER : int = 0x1081081
[static] Scale table of C5
Scale
  ST_RYUKYU : int = 0x18b18b1
[static] Scale table of Cryu
Scale
  ST_SPANISH : int = 0x15ab5ab
[static] Scale table of Cspa
Scale
  ST_UNISON : int = 0x1001001
[static] Scale table of Cu
Scale
  ST_WHOLE_TONE : int = 0x1555555
[static] Scale table of Cw
Scale
Property Detail
_defaultCenterOctaveproperty
protected var _defaultCenterOctave:int

default center octave, this apply when there are no octave specification.

_noteNamesproperty 
protected static var _noteNames:Array

note names

_scaleNameproperty 
protected var _scaleName:String

scale name

_scaleNotesproperty 
protected var _scaleNotes:Vector.<int>

notes on the scale

_scaleTableproperty 
protected var _scaleTable:int

scale table

_scaleTableDictionaryproperty 
protected static var _scaleTableDictionary:*

scale table dictionary

_tensionNotesproperty 
protected var _tensionNotes:Vector.<int>

notes on 1octave upper scale

bassNoteproperty 
bassNote:int

bass note number


Implementation
    public function get bassNote():int
    public function set bassNote(value:int):void
centerOctaveproperty 
centerOctave:int

center octave


Implementation
    public function get centerOctave():int
    public function set centerOctave(value:int):void
nameproperty 
name:String

Scale name. The regular expression of name is /(o[0-9])?([A-Ga-g])([+#\-])?([a-z0-9]+)?/. The 1st letter means center octave. default octave = 5 (when omit). The 2nd letter means root note. The 3nd letter (option) means note shift sign. "+" and "#" shift +1, "-" shifts -1. The 4th letters (option) means scale as follows.

the 3rd lettersscale
(no matching), ionMajor scale
m, nm, aeoNatural minor scale
hmHarmonic minor scale
mmMelodic minor scale
pPentatonic scale
mpMinor pentatonic scale
bBlue note scale
dDiminish scale
cdCombination of diminish scale
wWhole tone scale
cChromatic scale
sus4table of sus4 chord
sus47table of sus47 chord
5Power chord
uUnison (octave scale)
dorDorian mode
phrPhrigian mode
lydLydian mode
mixMixolydian mode
locLocrian mode
gypGypsy scale
spaSpanish scale
hanHangarian scale
japJapanese scale (Ritsu mode)
ryuJapanese scale (Ryukyu mode)
If you want to set "G sharp harmonic minor scale", name = "G+hm".


Implementation
    public function get name():String
    public function set name(value:String):void
rootNoteproperty 
rootNote:int

root note number


Implementation
    public function get rootNote():int
    public function set rootNote(value:int):void
Constructor Detail
Scale()Constructor
public function Scale(scaleName:String, defaultCenterOctave:int = 5)

constructor

Parameters
scaleName:String — scale name.
 
defaultCenterOctave:int (default = 5) — default center octave, this apply when there are no octave specification.

See also

Method Detail
_errorInvalidScaleName()method
protected function _errorInvalidScaleName(name:String):Error

Invalid scale name error

Parameters

name:String

Returns
Error
check()method 
public function check(note:int):Boolean

check note availability on this scale.

Parameters

note:int — MIDI note number (0-127).

Returns
Boolean — Returns true if the note is on this scale.
copyFrom()method 
public function copyFrom(src:Scale):Scale

copy from another scale

Parameters

src:Scale — another Scale instance copy from

Returns
Scale
getNote()method 
public function getNote(index:int):int

get note by index on this scale.

Parameters

index:int — index on this scale. You can specify both posi and nega values.

Returns
int — MIDI note number on this scale.
getScaleIndex()method 
public function getScaleIndex(note:int):int

get scale index from note.

Parameters

note:int

Returns
int
setScaleTable()method 
public function setScaleTable(name:String, rootNote:int, table:Array):void

set scale table manualy.

Parameters

name:String — name of this scale.
 
rootNote:int — root note of this scale.
 
table:Array


Example
If you want to set "F japanese scale (1 2 4 5 b7)".
    var table:Array = [1,0,1,0,0,1,0,1,0,0,1,0];  // c,d,f,g,b- is available on "C japanese scale".
    scale.setScaleTable("Fjap", 65, table);       // 65="F"s note number
shift()method 
public function shift(note:int):int

shift note to the nearest note on this scale.

Parameters

note:int — MIDI note number (0-127).

Returns
int — Returns shifted note. if the note is on this scale, no shift.
Constant Detail
ST_BLUE_NOTEConstant
protected static const ST_BLUE_NOTE:int = 0x14e94e9

Scale table of Cb

ST_CHROMATICConstant 
protected static const ST_CHROMATIC:int = 0x1ffffff

Scale table of Cc

ST_COMB_DIMINISHConstant 
protected static const ST_COMB_DIMINISH:int = 0x16db6db

Scale table of Ccd

ST_DIMINISHConstant 
protected static const ST_DIMINISH:int = 0x1249249

Scale table of Cd

ST_DORIANConstant 
protected static const ST_DORIAN:int = 0x16ad6ad

Scale table of Cdor

ST_DPERFECTConstant 
protected static const ST_DPERFECT:int = 0x14a14a1

Scale table of Csus47

ST_GYPSYConstant 
protected static const ST_GYPSY:int = 0x19b39b3

Scale table of Cgyp

ST_HANGARIANConstant 
protected static const ST_HANGARIAN:int = 0x1acdacd

Scale table of Chan

ST_HARMONIC_MINORConstant 
protected static const ST_HARMONIC_MINOR:int = 0x19ad9ad

Scale table of Chm

ST_JAPANESEConstant 
protected static const ST_JAPANESE:int = 0x14a54a5

Scale table of Cjap

ST_LOCRIANConstant 
protected static const ST_LOCRIAN:int = 0x156b56b

Scale table of Cloc

ST_LYDIANConstant 
protected static const ST_LYDIAN:int = 0x1ad5ad5

Scale table of Clyd

ST_MAJORConstant 
protected static const ST_MAJOR:int = 0x1ab5ab5

Scale table of C

ST_MELODIC_MINORConstant 
protected static const ST_MELODIC_MINOR:int = 0x1aadaad

Scale table of Cmm

ST_MINORConstant 
protected static const ST_MINOR:int = 0x15ad5ad

Scale table of Cm

ST_MINOR_PENTATONICConstant 
protected static const ST_MINOR_PENTATONIC:int = 0x14a94a9

Scale table of Cmp

ST_MIXOLYDIANConstant 
protected static const ST_MIXOLYDIAN:int = 0x16b56b5

Scale table of Cmix

ST_PENTATONICConstant 
protected static const ST_PENTATONIC:int = 0x1295295

Scale table of Cp

ST_PERFECTConstant 
protected static const ST_PERFECT:int = 0x10a10a1

Scale table of Csus4

ST_PHRIGIANConstant 
protected static const ST_PHRIGIAN:int = 0x15ab5ab

Scale table of Cphr

ST_POWERConstant 
protected static const ST_POWER:int = 0x1081081

Scale table of C5

ST_RYUKYUConstant 
protected static const ST_RYUKYU:int = 0x18b18b1

Scale table of Cryu

ST_SPANISHConstant 
protected static const ST_SPANISH:int = 0x15ab5ab

Scale table of Cspa

ST_UNISONConstant 
protected static const ST_UNISON:int = 0x1001001

Scale table of Cu

ST_WHOLE_TONEConstant 
protected static const ST_WHOLE_TONE:int = 0x1555555

Scale table of Cw