Documentation ¶
Index ¶
- Constants
- Variables
- func AscNames(i int) int
- func DescNames(i int) int
- type Chord
- type Duration
- type Interval
- func Augmented(step int) Interval
- func Diminished(step int) Interval
- func DoublyAugmented(step int) Interval
- func DoublyDiminished(step int) Interval
- func Major(step int) Interval
- func Minor(step int) Interval
- func NewInterval(step, octaves, offset int) Interval
- func Octave(step int) Interval
- func ParseInterval(str string) (Interval, error)
- func Perfect(step int) Interval
- func Semitones(step int) Interval
- type IntervalFunc
- type ModifierStrategy
- type Note
- type Pitch
- type Quality
- type QualityType
- type Scale
Constants ¶
const ( DoubleFlat = -2 Flat = -1 Natural = 0 Sharp = 1 DoubleSharp = 2 )
Modifiers
const ( C int = iota + 1 D E F G A B )
Note naturals
Variables ¶
var ( D1 = Duration{1, 0, false} // Whole D2 = Duration{2, 0, false} // Half D4 = Duration{4, 0, false} // Quarter D8 = Duration{8, 0, false} // Eighth D16 = Duration{16, 0, false} // Sixteenth D32 = Duration{32, 0, false} // Thirty Second D64 = Duration{64, 0, false} // Sixty Fourth D128 = Duration{128, 0, false} // Hundred Twenty Eighth )
Durations
Functions ¶
Types ¶
type Chord ¶ added in v0.0.5
type Chord []Pitch
Chord is a series of Pitches intended to be played at the same time
type Interval ¶
Interval represents an interval in 12-tone equal temperament
func NewInterval ¶
NewInterval builds a new Interval
func ParseInterval ¶
type IntervalFunc ¶
IntervalFunc creates an interval at as specific step/degree
type ModifierStrategy ¶
ModifierStrategy is a function that maps a modifier to a diatonic
type Pitch ¶
type Pitch struct {
Interval
}
Pitch represents an absolute pitch in 12-tone equal temperament
func MustParsePitch ¶
MustParsePitch parses and returns a Pitch in scientific pitch notation or panics
func NearestPitch ¶ added in v0.0.5
NearestPitch returns the closest pitch to an arbitrary frequency
func ParsePitch ¶
ParsePitch parses and returns a Pitch in scientific pitch notation
func (Pitch) Name ¶
func (p Pitch) Name(strategy ModifierStrategy) string
Name returns the name of the pitch using a particular name strategy (either AscNames or DescNames). The result is in scientific pitch notation format.
type Quality ¶
type Quality struct { Type QualityType Size int }
Quality describes the quality of an interval
type QualityType ¶
type QualityType int
QualityType represents the type a Quality can take
const ( PerfectType QualityType = iota MajorType MinorType AugmentedType DiminishedType )
Quality types
func (QualityType) String ¶
func (q QualityType) String() string