Module: MusicSetTheory::Temperament

Extended by:
MusUtility
Includes:
MusUtility
Included in:
MusicSetTheory, NoteSeq
Defined in:
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb,
lib/music_set_theory/temperament.rb

Defined Under Namespace

Classes: SeqDict, Temperament

Constant Summary collapse

M_SHARP =

Unicode string constants for music notation. NOTE. DO NOT USE SINGLE QUOTES.

"\u266f"
M_NATURAL =
"\u266e"
M_FLAT =
"\u266d"
MNU_SHARP =

Since this may not display on browsers, there are non-Unicode equivalents. MNU_SHARP = "#"

"#"
RE_SHARP =
"\\#{MNU_SHARP}"
MNU_FLAT =
"b"
MNU_NATURAL =
"n"
RE_NOTEPARSE =

This constant is used for parsing note names into keys.

https://docs.ruby-lang.org/ja/latest/doc/spec=2fregexp.html#capture https://docs.ruby-lang.org/ja/latest/doc/spec=2fregexp.html#option

ok. RE_NOTEPARSE = /(? # named capture. [A-Z] (b|n|#| # WARN: hashtag MUST BE ESCAPED # with backslash in Free format mode. #M_FLAT|#M_NATURAL|#M_SHARP)* )/x # free format mode.

(#MNU_FLAT|#MNU_NATURAL|#| ng. (#MNU_FLAT|#MNU_NATURAL|#MNU_SHARP| #ng.

/(?<basenotename>    # named capture.
 [A-Z]
 (#{MNU_FLAT}|#{MNU_NATURAL}|#{RE_SHARP}|
  #{M_FLAT}  |#{M_NATURAL}  |#{M_SHARP})*
)/x
NSEQ_SCALE =

Constants used for the nseq_type arguments in noteseqs. See scales.py for more information.

0
NSEQ_CHORD =

Used for specifying scales.

1
NSEQ_TYPE_HASH =

Used for specifying chords.

{
  NSEQ_SCALE => 'SCALE',
  NSEQ_CHORD => 'CHORD',
}
CHROM_SIZE =
CHROM_SIZE

number of semitones.

CHROM_NAT_NOTE_POS

position in number of semitones. ex. D = 2 (i.e., C + #*2), E = 4 (C + #*4), etc.

CHROM_NAT_NOTES

natural notes.

12
CHROM_NAT_NOTES =
["C", "D", "E", "F", "G", "A", "B"]
CHROM_NAT_NOTE_POS =
[  0,   2,   4,   5,   7,   9,  11]
WestTemp =

freeze for debug. WestTemp = MusicSetTheory.deep_freeze(WestTempNew())

WestTempNew()
WestTment =

ok. (dependancied removed in test cases).

WestTemp

Constants included from MusUtility

MusUtility::SPACECOMMA

Class Method Summary collapse

Instance Method Summary collapse

Methods included from MusUtility

deep_freeze, deep_melt, enl_seq, multislice, norm_seq, repseq, rotate, rotate_and_zero, scalar_addition, seqtostr

Class Method Details

.WestTempNewObject



826
827
828
# File 'lib/music_set_theory/temperament.rb', line 826

def self.WestTempNew
  Temperament.new(CHROM_SIZE, CHROM_NAT_NOTES, CHROM_NAT_NOTE_POS)
end

Instance Method Details

#un_unicode_accdtls(str_note) ⇒ Object

Turns all Unicode musical characters in str_note to their ASCII equivalent, and returns the result.

Note: the function is intended for viewing musical scales through deficient browsers like IE 6 and 7. Characters may appear as blocks in these environments.



169
170
171
172
173
174
# File 'lib/music_set_theory/temperament.rb', line 169

def un_unicode_accdtls(str_note)
  ret = str_note.gsub(/#{M_FLAT}/, MNU_FLAT).
          gsub(/#{M_SHARP}/, MNU_SHARP).
          gsub(/#{M_NATURAL}/, MNU_NATURAL)
  ret
end

#WestTempNewObject



829
830
831
# File 'lib/music_set_theory/temperament.rb', line 829

def WestTempNew
  MusicSetTheory::Temperament.WestTempNew()
end