op

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownDynamicSign = errors.New("UnknownDynamicSign")
)

Functions

func GetDynamicSignStrings

func GetDynamicSignStrings() []string

Types

type Accidental

type Accidental int
const (
	UnknownAccidental Accidental = iota
	Natural
	Sharp
	Flat
)

func NewAccidental

func NewAccidental(s string) Accidental

func (Accidental) AsNoteAccidental

func (a Accidental) AsNoteAccidental() note.Accidental

func (Accidental) MarshalJSON

func (a Accidental) MarshalJSON() ([]byte, error)

func (Accidental) MarshalYAML

func (a Accidental) MarshalYAML() (any, error)

func (Accidental) Semitone

func (a Accidental) Semitone() note.Semitone

func (Accidental) String

func (a Accidental) String() string

func (Accidental) Tendency

func (a Accidental) Tendency(x Accidental) Accidental

Tendency calculates the substantial temporary accidental of x with reference to a.

type BPM

type BPM uint

func NewBPM

func NewBPM(v uint) (BPM, error)

func (BPM) MarshalYAML

func (b BPM) MarshalYAML() (any, error)

func (*BPM) UnmarshalYAML

func (b *BPM) UnmarshalYAML(value *yaml.Node) error

type Chord

type Chord struct {
	Degree note.Degree `yaml:"degree"`
	Chord  chord.Chord `yaml:"chord"`
	Base   note.Degree `yaml:"base,omitempty"`
}

func NewChord

func NewChord(degree note.Degree, c chord.Chord, base *note.Degree) Chord

func (Chord) String

func (c Chord) String() string

type Circle

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

func NewCircle

func NewCircle(r util.Ring[CircleMember]) Circle

func (Circle) All

func (c Circle) All() iter.Seq[CircleMember]

func (Circle) At

func (c Circle) At(i int) CircleMember

func (Circle) Index

func (c Circle) Index(key Key) (int, bool)

type CircleMember

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

func NewCircleMember

func NewCircleMember(ss ...*Scale) CircleMember

func (CircleMember) Get

func (c CircleMember) Get(key Key) (*Scale, bool)

func (CircleMember) Head

func (c CircleMember) Head() *Scale

func (CircleMember) Keys

func (c CircleMember) Keys() util.Set[Key]

func (CircleMember) String

func (c CircleMember) String() string

type CircleOfFifth

type CircleOfFifth struct {
	Minors Circle
	Majors Circle
}

func NewCircleOfFifth

func NewCircleOfFifth() CircleOfFifth

func (CircleOfFifth) Dominant

func (c CircleOfFifth) Dominant(key Key) (CircleMember, error)

func (CircleOfFifth) Parallel

func (c CircleOfFifth) Parallel(key Key) (CircleMember, error)

Parallel returns a key that has the same tonic but with the major and minor modes swapped.

func (CircleOfFifth) Relative

func (c CircleOfFifth) Relative(key Key) (CircleMember, error)

Relative returns a key that has the same signature but with the major and minor modes swapped.

func (CircleOfFifth) SubDominant

func (c CircleOfFifth) SubDominant(key Key) (CircleMember, error)

type DiatonicChord

type DiatonicChord struct {
	Note *ScaleNote
	Name string
}

func (DiatonicChord) MarshalYAML

func (dc DiatonicChord) MarshalYAML() (any, error)

func (DiatonicChord) String

func (dc DiatonicChord) String() string

type DiatonicChorder

type DiatonicChorder interface {
	Sevenths() [7]DiatonicChord
	Triads() [7]DiatonicChord
}

type DiatonicChorderImpl

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

func NewDiatonicChorder

func NewDiatonicChorder(scale *Scale) *DiatonicChorderImpl

func (DiatonicChorderImpl) Sevenths

func (dc DiatonicChorderImpl) Sevenths() [7]DiatonicChord

func (DiatonicChorderImpl) Triads

func (dc DiatonicChorderImpl) Triads() [7]DiatonicChord

type DynamicSign

type DynamicSign int
const (
	UnknownDynamicSign DynamicSign = iota
	Pianissimo
	Piano
	MezzoPiano
	MezzoForte
	Forte
	Fortissimo
)

func NewDynamicSign

func NewDynamicSign(s string) DynamicSign

func (DynamicSign) MarshalYAML

func (d DynamicSign) MarshalYAML() (any, error)

func (DynamicSign) String

func (d DynamicSign) String() string

func (*DynamicSign) UnmarshalYAML

func (d *DynamicSign) UnmarshalYAML(value *yaml.Node) error

func (DynamicSign) Velocity

func (d DynamicSign) Velocity() Velocity

type Instance

type Instance struct {
	Chord  *Chord       `yaml:"chord,omitempty"`
	Values []note.Value `yaml:"values"`

	BPM      *BPM         `yaml:"bpm,omitempty"`
	Velocity *DynamicSign `yaml:"velocity,omitempty"`
	Meter    *Meter       `yaml:"meter,omitempty"`
	Key      *Key         `yaml:"key,omitempty"`
	Meta     *Meta        `yaml:"meta,omitempty"`
}

func (Instance) IsRest

func (i Instance) IsRest() bool

func (Instance) Validate

func (i Instance) Validate() error

type Key

type Key struct {
	Name       note.Name  `json:"name" yaml:"name"`
	Minor      bool       `json:"minor" yaml:"minor"`
	Accidental Accidental `json:"accidental" yaml:"accidental"`
}

func MustParseKey

func MustParseKey(s string) Key

func ParseKey

func ParseKey(s string) (Key, error)

func (Key) MarshalYAML

func (k Key) MarshalYAML() (any, error)

func (Key) Semitone

func (k Key) Semitone() note.Semitone

func (Key) String

func (k Key) String() string

func (*Key) UnmarshalYAML

func (k *Key) UnmarshalYAML(value *yaml.Node) error

type KeyConversion

type KeyConversion int
const (
	UnknownKeyConversion KeyConversion = iota
	ParallelKey
	RelativeKey
	DominantKey
	SubDominantKey
)

func (KeyConversion) Converter

func (k KeyConversion) Converter(c CircleOfFifth) func(Key) (CircleMember, error)

func (KeyConversion) String

func (i KeyConversion) String() string

type KeyConversionChain

type KeyConversionChain []KeyConversion

func (KeyConversionChain) Convert

func (cc KeyConversionChain) Convert(c CircleOfFifth, key Key) (CircleMember, error)

type Meta

type Meta map[string]string

func NewMeta

func NewMeta(keyValues ...string) *Meta

func (Meta) Get

func (m Meta) Get(key string) string

func (Meta) Set

func (m Meta) Set(key, value string)

type Meter

type Meter struct {
	util.Rat
}

func MustNewMeter

func MustNewMeter(num, denom uint) Meter

func NewMeter

func NewMeter(num, denom uint) (Meter, error)

func (*Meter) UnmarshalYAML

func (m *Meter) UnmarshalYAML(value *yaml.Node) error

type Scale

type Scale struct {
	Key   Key           `json:"key" yaml:"key"`
	Notes [7]*ScaleNote `json:"notes" yaml:"notes"`
	Flat  int           `json:"flat,omitempty" yaml:"flat,omitempty"`
	Sharp int           `json:"sharp,omitempty" yaml:"sharp,omitempty"`
}

func AllScales

func AllScales() []*Scale

func MustNewScale

func MustNewScale(key Key) *Scale

func NewScale

func NewScale(key Key) (*Scale, error)

func (Scale) GetNoteIndexByName

func (s Scale) GetNoteIndexByName(n note.Name) (int, error)

func (Scale) Tonic

func (s Scale) Tonic() *ScaleNote

type ScaleNote

type ScaleNote struct {
	Name       note.Name  `json:"note" yaml:"note"`
	Accidental Accidental `json:"accidental,omitempty" yaml:"accidental,omitempty"`
}

func (ScaleNote) GetDegree

func (n ScaleNote) GetDegree(x *ScaleNote, isSharp bool) (note.Degree, error)

func (ScaleNote) MarshalYAML

func (n ScaleNote) MarshalYAML() (any, error)

func (ScaleNote) Semitone

func (n ScaleNote) Semitone() note.Semitone

func (ScaleNote) String

func (n ScaleNote) String() string

type Velocity

type Velocity uint8

Jump to

Keyboard shortcuts

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