chord

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute struct {
	Name   string `yaml:"name"`
	Degree Degree `yaml:"degree,omitempty"`
}

Named degree.

func BasicAttributes

func BasicAttributes() []Attribute

func GenerateAttributes

func GenerateAttributes(maxDegree uint) []Attribute

func ParseAttributes

func ParseAttributes(b []byte) ([]Attribute, error)

func (Attribute) Semitone

func (a Attribute) Semitone() (Semitone, bool)

type Builder

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

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Attribute

func (b *Builder) Attribute(a Attribute)

func (Builder) Build

func (b Builder) Build() (*Map, error)

func (*Builder) Chord

func (b *Builder) Chord(c Chord)

func (Builder) UnwrapAttributes

func (b Builder) UnwrapAttributes() []Attribute

func (Builder) UnwrapChords

func (b Builder) UnwrapChords() []Chord

type Chord

type Chord struct {
	Name string   `yaml:"name"`
	Meta Metadata `yaml:"meta"`
	// attribute names
	Attributes []string `yaml:"attributes,omitempty"`
	// chord name
	Extends string `yaml:"extends,omitempty"`
}

func BasicChords

func BasicChords() []Chord

func ParseChords

func ParseChords(b []byte) ([]Chord, error)

type Degree

type Degree = note.Degree

type Map

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

func NewMap

func NewMap(
	attributes map[string]Attribute,
	chords map[string]Chord,
) (*Map, error)

func (Map) GetAttribute

func (m Map) GetAttribute(name string) (Attribute, bool)

func (Map) GetChord

func (m Map) GetChord(nameOrDisplay string) (Chord, bool)

func (Map) GetChordAttributes

func (m Map) GetChordAttributes(nameOrDisplay string) ([]Attribute, bool)

type Mapper

type Mapper interface {
	GetChord(nameOrDisplay string) (Chord, bool)
	GetChordAttributes(nameOrDiaplay string) ([]Attribute, bool)
	GetAttribute(name string) (Attribute, bool)
}

Mapper is a Chord dictionary.

type Metadata

type Metadata struct {
	Display string `yaml:"display"`
}

type Semitone

type Semitone = note.Semitone

Jump to

Keyboard shortcuts

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