struct Mystic::Coords

Overview

Coordinate representation of pitches

Pitches are represented by a combination of octaves and fifths away from Middle C

For example, the C#4 is represented as (-4, 7), and Db4 is (3, -5).

The benefit of this approach over a semitone-based system is that it is easier to keep track of enharmonic notes, and it also makes interval math much simpler.

Defined in:

mystic/coords.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(octaves : Int32, fifths : Int32) #

[View source]

Instance Method Detail

def *(i : Int32) : Coords #

[View source]
def +(other : self) : Coords #

[View source]
def -(other : self) : Coords #

[View source]
def ==(other : self) : Bool #

[View source]
def fifths : Int32 #

[View source]
def octaves : Int32 #

[View source]
def to_s(io : IO) : Nil #
Description copied from struct Struct

Same as #inspect(io).


[View source]
def value : Int32 #

Returns the pitch offset from Middle C and can be used to calculate the pitch name


[View source]