Class: MusicSetTheory::NoteSeqScale

Inherits:
NoteSeq
  • Object
show all
Defined in:
lib/music_set_theory/scales.rb,
lib/music_set_theory/scales.rb

Constant Summary

Constants included from MusUtility

MusUtility::SPACECOMMA

Constants included from Temperament

Temperament::CHROM_NAT_NOTES, Temperament::CHROM_NAT_NOTE_POS, Temperament::CHROM_SIZE, Temperament::MNU_FLAT, Temperament::MNU_NATURAL, Temperament::MNU_SHARP, Temperament::M_FLAT, Temperament::M_NATURAL, Temperament::M_SHARP, Temperament::NSEQ_CHORD, Temperament::NSEQ_SCALE, Temperament::NSEQ_TYPE_HASH, Temperament::RE_NOTEPARSE, Temperament::RE_SHARP, Temperament::WestTemp, Temperament::WestTment

Instance Attribute Summary

Attributes inherited from NoteSeq

#nseq_abbrev, #nseq_name, #nseq_nat_posns, #nseq_other_abbrevs, #nseq_posn, #nseq_synonyms, #nseq_temp, #nseq_type

Instance Method Summary collapse

Methods inherited from NoteSeq

#get_notes_for_key, #get_posn_for_offset, #register_with_temp

Methods included from MusUtility

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

Methods included from Temperament

#WestTempNew, WestTempNew, #un_unicode_accdtls

Constructor Details

#initialize(nseq_name, nseq_temp, nseq_posn, nseq_nat_posns, nseq_modes = [], debug_f: false) ⇒ NoteSeqScale

Args

nseq_name

name of scale.

nseq_temp

temperament for scale.

nseq_posn

position of notes in scale.

nseq_nat_posns

natural note positions for notes in scales.

nseq_modes

a sequence of modes for the scale, listed in order of position.



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/music_set_theory/scales.rb', line 300

def initialize( nseq_name, nseq_temp, nseq_posn, nseq_nat_posns,
                nseq_modes = [], debug_f: false )
  #
  return super(
    nseq_name, NSEQ_SCALE, nseq_temp, nseq_posn, nseq_nat_posns
  ) if nseq_modes.empty?

  ###
  super(nseq_name, NSEQ_SCALE, nseq_temp, nseq_posn, nseq_nat_posns,
        nseq_abbrev: "", nseq_synonyms: [nseq_modes[0]])

  new_nseq_pos      = nseq_posn
  new_nseq_nat_pos  = nseq_nat_posns

  # This creates more instances of noteseq_scales - all for the different
  # modes.
  # By creating them, they will be automatically connected to the
  # appropriate temperament's dictionary.
  for i in 1...nseq_posn.size
    $stderr.puts "{#{__method__}} new_nseq_pos: #{new_nseq_pos.inspect}," +
      " new_nseq_nat_pos: #{new_nseq_nat_pos.inspect}" if debug_f

    new_nseq_pos     = rotate_and_zero(new_nseq_pos, 1, nseq_temp.no_keys)
    new_nseq_nat_pos = rotate_and_zero(new_nseq_nat_pos, 1,
                         nseq_temp.no_nat_keys)

    # create an other scale.
    NoteSeqScale.new(
      nseq_modes[i], nseq_temp, new_nseq_pos, new_nseq_nat_pos)
  end
end

Instance Method Details

#to_sObject



332
333
334
# File 'lib/music_set_theory/scales.rb', line 332

def to_s
  self.nseq_name.to_s
end