musical

package
v0.0.0-...-5d1ec56 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnknownQuality = Quality(iota)
	Major
	Minor
	Diminished
	Augmented
)

Variables

View Source
var (
	StandardTuningSteps = TuningSteps{
						// contains filtered or unexported fields
	}
	DropTuningSteps = TuningSteps{
					// contains filtered or unexported fields
	}
)
View Source
var (
	TuningEStandard = Tuning{Tonic: E.TransposeOctave(2), Steps: StandardTuningSteps}
	TuningDStandard = Tuning{Tonic: D.TransposeOctave(2), Steps: StandardTuningSteps}
	TuningDropD     = Tuning{Tonic: D.TransposeOctave(2), Steps: DropTuningSteps}
	TuningDropC     = Tuning{Tonic: C.TransposeOctave(2), Steps: DropTuningSteps}
)
View Source
var (
	// Basic Scales
	MajorScaleDegrees = ScaleDegrees{
						// contains filtered or unexported fields
	}
	MinorScaleDegrees = MajorScaleDegrees.Shift("minor", 6)

	// Major Modes
	IonianScaleDegrees     = MajorScaleDegrees.Shift("ionian", 1)
	DorianScaleDegrees     = IonianScaleDegrees.Shift("dorian", 2)
	PhrygianScaleDegrees   = IonianScaleDegrees.Shift("phrygian", 3)
	LydianScaleDegrees     = IonianScaleDegrees.Shift("lydian", 4)
	MixolydianScaleDegrees = IonianScaleDegrees.Shift("mixolydian", 5)
	AeolianScaleDegrees    = IonianScaleDegrees.Shift("aeolian", 6)
	LocrianScaleDegrees    = IonianScaleDegrees.Shift("locrian", 7)

	// Blues Scales
	HexatonicBluesScaleDegrees = ScaleDegrees{
								// contains filtered or unexported fields
	}
	HeptatonicBluesScaleDegrees = ScaleDegrees{
								// contains filtered or unexported fields
	}
	NonatonicBluesScaleDegrees = ScaleDegrees{
								// contains filtered or unexported fields
	}

	// Japanese Scales
	HirajōshiScaleDegrees = ScaleDegrees{
							// contains filtered or unexported fields
	}
)

Functions

func AbsI

func AbsI[A constraints.Integer](value A) A

func ClampI

func ClampI[A constraints.Integer](value, min, max A) A

func ReverseCopy

func ReverseCopy[T any](slice []T) []T

Types

type Accidental

type Accidental int
const (
	Natural Accidental = 0
	Flat    Accidental = -1
	Sharp   Accidental = 1
)

func (Accidental) String

func (a Accidental) String() string

type Chord

type Chord struct {
	Notes []Note
	// contains filtered or unexported fields
}

func NewTriad

func NewTriad(notes [3]Note) Chord

func (*Chord) Name

func (c *Chord) Name() string

type Fretboard

type Fretboard struct {
	Tuning Tuning
}

func (*Fretboard) String

func (f *Fretboard) String() string

type Note

type Note struct {
	// contains filtered or unexported fields
}
var (
	C Note = Note{/* contains filtered or unexported fields */}
	D Note = Note{/* contains filtered or unexported fields */}
	E Note = Note{/* contains filtered or unexported fields */}
	F Note = Note{/* contains filtered or unexported fields */}
	G Note = Note{/* contains filtered or unexported fields */}
	A Note = Note{/* contains filtered or unexported fields */}
	B Note = Note{/* contains filtered or unexported fields */}
)

func NoteFromValue

func NoteFromValue(value uint) Note

func (Note) Accidental

func (n Note) Accidental(a Accidental) Note

func (Note) Interval

func (n Note) Interval(other Note) int

func (Note) ShortName

func (n Note) ShortName() string

func (Note) String

func (n Note) String() string

func (Note) TransposeOctave

func (n Note) TransposeOctave(x int) Note

func (Note) TransposeSemitone

func (n Note) TransposeSemitone(x int) Note

type Quality

type Quality uint

func (Quality) String

func (q Quality) String() string

type Scale

type Scale struct {
	Tonic   Note
	Degrees ScaleDegrees
}

func (*Scale) Chords

func (s *Scale) Chords() []Chord

func (*Scale) Name

func (s *Scale) Name() string

func (*Scale) Notes

func (s *Scale) Notes() []Note

func (*Scale) String

func (s *Scale) String() string

type ScaleDegrees

type ScaleDegrees struct {
	// contains filtered or unexported fields
}

1 = a semitone

func (*ScaleDegrees) Shift

func (s *ScaleDegrees) Shift(name string, offset int) ScaleDegrees

type Tuning

type Tuning struct {
	Tonic Note
	Steps TuningSteps
}

func (*Tuning) Name

func (t *Tuning) Name() string

func (*Tuning) Notes

func (t *Tuning) Notes() []Note

type TuningSteps

type TuningSteps struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL