Sha256: 8e583a9a4532537a308bd43d73b74799e3442694c5ca2e4add58a2d060b03a4a
Contents?: true
Size: 848 Bytes
Versions: 2
Compression:
Stored size: 848 Bytes
Contents
module Coltrane # This class describes an actual implementation of a Chord, being aware # of exact octaves of each pitch and even repeating pitches across octaves. class Voicing attr_reader :pitches def initialize(*pitch_strings, pitches: nil) @pitches = if pitch_strings.any? pitch_strings.map { |s| Pitch[s] } elsif pitches pitches else raise WrongArgumentsError end end def self.[](*args) new(*args) end def pitch_classes NoteSet[*pitches.map(&:pitch_class).uniq] end alias notes pitch_classes def chord @chord ||= Chord.new(notes: notes) rescue ChordNotFoundError return false end def frequencies pitches.map(&:frequency) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
coltrane-2.1.5 | lib/coltrane/voicing.rb |
coltrane-2.1.0 | lib/coltrane/voicing.rb |