class HeadMusic::PitchClassSet

A PitchClassSet represents a pitch-class set or pitch collection. See also: PitchSet, PitchClass

Attributes

pitch_classes[R]

Public Class Methods

new(identifiers) click to toggle source
# File lib/head_music/pitch_class_set.rb, line 11
def initialize(identifiers)
  @pitch_classes = identifiers.map { |identifier| HeadMusic::PitchClass.get(identifier) }.uniq.sort
end

Public Instance Methods

==(other) click to toggle source
# File lib/head_music/pitch_class_set.rb, line 23
def ==(other)
  pitch_classes == other.pitch_classes
end
decachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 73
def decachord?
  pitch_classes.length == 10
end
dichord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 40
def dichord?
  pitch_classes.length == 2
end
Also aliased as: dyad?
dodecachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 81
def dodecachord?
  pitch_classes.length == 12
end
dyad?()
Alias for: dichord?
equivalent?(other) click to toggle source
# File lib/head_music/pitch_class_set.rb, line 27
def equivalent?(other)
  pitch_classes.sort == other.pitch_classes.sort
end
heptachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 61
def heptachord?
  pitch_classes.length == 7
end
hexachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 57
def hexachord?
  pitch_classes.length == 6
end
inspect() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 15
def inspect
  pitch_classes.map(&:to_s).join(' ')
end
monad?()
Alias for: monochord?
monochord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 35
def monochord?
  pitch_classes.length == 1
end
Also aliased as: monad?
nonachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 69
def nonachord?
  pitch_classes.length == 9
end
octachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 65
def octachord?
  pitch_classes.length == 8
end
pentachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 53
def pentachord?
  pitch_classes.length == 5
end
size() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 31
def size
  @size ||= pitch_classes.length
end
tetrachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 49
def tetrachord?
  pitch_classes.length == 4
end
to_s() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 19
def to_s
  pitch_classes.map(&:to_s).join(' ')
end
trichord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 45
def trichord?
  pitch_classes.length == 3
end
undecachord?() click to toggle source
# File lib/head_music/pitch_class_set.rb, line 77
def undecachord?
  pitch_classes.length == 11
end