lib

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var A = Note{
	Ord:  9,
	Name: `A`,
}
View Source
var A_FLAT = Note{
	Ord:  8,
	Name: `A♭`,
}
View Source
var A_FLAT_MAJOR = Scale{

	Name:        `A♭ major`,
	Accidentals: -4,
	Type:        Major,
	Notes:       []Note{A_FLAT, B_FLAT, C, D_FLAT, E_FLAT, F, G},
	// contains filtered or unexported fields
}
View Source
var A_FLAT_MINOR = Scale{

	Name:        `A♭ minor`,
	Accidentals: -7,
	Type:        Minor,
	Notes:       []Note{A_FLAT, B_FLAT, C_FLAT, D_FLAT, E_FLAT, F_FLAT, G_FLAT},
	// contains filtered or unexported fields
}

A♭ minor/G♯ minor

View Source
var A_MAJOR = Scale{

	Name:        `A major`,
	Accidentals: 3,
	Type:        Major,
	Notes:       []Note{A, B, C_SHARP, D, E, F_SHARP, G_SHARP},
	// contains filtered or unexported fields
}
View Source
var A_MINOR = Scale{

	Name:        `A minor`,
	Accidentals: 0,
	Type:        Minor,
	Notes:       []Note{A, B, C, D, E, F, G},
	// contains filtered or unexported fields
}
View Source
var A_SHARP = Note{
	Ord:  10,
	Name: `A♯`,
}
View Source
var A_SHARP_MINOR = Scale{

	Name:        `A♯ minor`,
	Accidentals: 7,
	Type:        Minor,
	Notes:       []Note{A_SHARP, B_SHARP, C_SHARP, D_SHARP, E_SHARP, F_SHARP, G_SHARP},
	// contains filtered or unexported fields
}

A♯ minor/B♭ minor

View Source
var B = Note{
	Ord:  11,
	Name: `B`,
}
View Source
var B_FLAT = Note{
	Ord:  10,
	Name: `B♭`,
}
View Source
var B_FLAT_MAJOR = Scale{

	Name:        `B♭ major`,
	Accidentals: -2,
	Type:        Major,
	Notes:       []Note{B_FLAT, C, D, E_FLAT, F, G, A},
	// contains filtered or unexported fields
}
View Source
var B_FLAT_MINOR = Scale{

	Name:        `B♭ minor`,
	Accidentals: -5,
	Type:        Minor,
	Notes:       []Note{B_FLAT, C, D_FLAT, E_FLAT, F, G_FLAT, A_FLAT},
	// contains filtered or unexported fields
}

B♭ minor/A♯ minor

View Source
var B_MAJOR = Scale{

	Name:        `B major`,
	Accidentals: 5,
	Type:        Major,
	Notes:       []Note{B, C_SHARP, D_SHARP, E, F_SHARP, G_SHARP, A_SHARP},
	// contains filtered or unexported fields
}

enharmonic to C♭ major

View Source
var B_MINOR = Scale{

	Name:        `B minor`,
	Accidentals: 2,
	Type:        Minor,
	Notes:       []Note{B, C_SHARP, D, E, F_SHARP, G, A},
	// contains filtered or unexported fields
}
View Source
var B_SHARP = Note{
	Ord:  0,
	Name: `B♯`,
}
View Source
var C = Note{
	Ord:  0,
	Name: `C`,
}
View Source
var C_FLAT = Note{
	Ord:  11,
	Name: `C♭`,
}
View Source
var C_FLAT_MAJOR = Scale{

	Name:        `C♭ major`,
	Accidentals: -7,
	Type:        Major,
	Notes:       []Note{C_FLAT, D_FLAT, E_FLAT, F_FLAT, G_FLAT, A_FLAT, B_FLAT},
	// contains filtered or unexported fields
}

enharmonic to E major

View Source
var C_MAJOR = Scale{

	Name:        `C major`,
	Accidentals: 0,
	Type:        Major,
	Notes:       []Note{C, D, E, F, G, A, B},
	// contains filtered or unexported fields
}
View Source
var C_MINOR = Scale{

	Name:        `C minor`,
	Accidentals: -3,
	Type:        Minor,
	Notes:       []Note{C, D, E_FLAT, F, G, A_FLAT, B_FLAT},
	// contains filtered or unexported fields
}
View Source
var C_SHARP = Note{
	Ord:  1,
	Name: `C♯`,
}
View Source
var C_SHARP_MAJOR = Scale{

	Name:        `C♯ major`,
	Accidentals: 7,
	Type:        Major,
	Notes:       []Note{C_SHARP, D_SHARP, E_SHARP, F_SHARP, G_SHARP, A_SHARP, B_SHARP},
	// contains filtered or unexported fields
}

enharmonic to D major

View Source
var C_SHARP_MINOR = Scale{

	Name:        `C♯ minor`,
	Accidentals: 4,
	Type:        Minor,
	Notes:       []Note{C_SHARP, D_SHARP, E, F_SHARP, G_SHARP, A, B},
	// contains filtered or unexported fields
}
View Source
var D = Note{
	Ord:  2,
	Name: `D`,
}
View Source
var D_FLAT = Note{
	Ord:  1,
	Name: `D♭`,
}
View Source
var D_FLAT_MAJOR = Scale{

	Name:        `D♭ major`,
	Accidentals: -5,
	Type:        Major,
	Notes:       []Note{D_FLAT, E_FLAT, F, G_FLAT, A_FLAT, B_FLAT, C},
	// contains filtered or unexported fields
}

enharmonic to C# major

View Source
var D_MAJOR = Scale{

	Name:        `D major`,
	Accidentals: 2,
	Type:        Major,
	Notes:       []Note{D, E, F_SHARP, G, A, B, C_SHARP},
	// contains filtered or unexported fields
}
View Source
var D_MINOR = Scale{

	Name:        `D minor`,
	Accidentals: -1,
	Type:        Minor,
	Notes:       []Note{D, E, F, G, A, B_FLAT, C},
	// contains filtered or unexported fields
}
View Source
var D_SHARP = Note{
	Ord:  3,
	Name: `D♯`,
}
View Source
var D_SHARP_MINOR = Scale{

	Name:        `D♯ minor`,
	Accidentals: 6,
	Type:        Minor,
	Notes:       []Note{D_SHARP, E_SHARP, F_SHARP, G_SHARP, A_SHARP, B, C_SHARP},
	// contains filtered or unexported fields
}

/D♯ minor/E♭ minor

View Source
var E = Note{
	Ord:  4,
	Name: `E`,
}
View Source
var E_FLAT = Note{
	Ord:  3,
	Name: `E♭`,
}
View Source
var E_FLAT_MAJOR = Scale{

	Name:        `E♭ major`,
	Accidentals: -3,
	Type:        Major,
	Notes:       []Note{E_FLAT, F, G, A_FLAT, B_FLAT, C, D},
	// contains filtered or unexported fields
}
View Source
var E_FLAT_MINOR = Scale{

	Name:        `E♭ minor`,
	Accidentals: -6,
	Type:        Minor,
	Notes:       []Note{E_FLAT, F, G_FLAT, A_FLAT, B_FLAT, C_FLAT, D_FLAT},
	// contains filtered or unexported fields
}

E♭ minor/D♯ minor

View Source
var E_MAJOR = Scale{

	Name:        `E major`,
	Accidentals: 4,
	Type:        Major,
	Notes:       []Note{E, F_SHARP, G_SHARP, A, B, C_SHARP, D_SHARP},
	// contains filtered or unexported fields
}
View Source
var E_MINOR = Scale{

	Name:        `E minor`,
	Accidentals: 1,
	Type:        Minor,
	Notes:       []Note{E, F_SHARP, G, A, B, C, D},
	// contains filtered or unexported fields
}
View Source
var E_SHARP = Note{
	Ord:  5,
	Name: `E♯`,
}
View Source
var F = Note{
	Ord:  5,
	Name: `F`,
}
View Source
var F_FLAT = Note{
	Ord:  4,
	Name: `F♭`,
}
View Source
var F_MAJOR = Scale{

	Name:        `F major`,
	Accidentals: -1,
	Type:        Major,
	Notes:       []Note{F, G, A, B_FLAT, C, D, E},
	// contains filtered or unexported fields
}
View Source
var F_MINOR = Scale{

	Name:        `F minor`,
	Accidentals: -4,
	Type:        Minor,
	Notes:       []Note{F, G, A_FLAT, B_FLAT, C, D_FLAT, E_FLAT},
	// contains filtered or unexported fields
}
View Source
var F_SHARP = Note{
	Ord:  6,
	Name: `F♯`,
}
View Source
var F_SHARP_MAJOR = Scale{

	Name:        `F♯ major`,
	Accidentals: 6,
	Type:        Major,
	Notes:       []Note{F_SHARP, G_SHARP, A_SHARP, B, C_SHARP, D_SHARP, E_SHARP},
	// contains filtered or unexported fields
}

enharmonic to G♭ major

View Source
var F_SHARP_MINOR = Scale{

	Name:        `F♯ minor`,
	Accidentals: 3,
	Type:        Minor,
	Notes:       []Note{F_SHARP, G_SHARP, A, B, C_SHARP, D, E},
	// contains filtered or unexported fields
}
View Source
var G = Note{
	Ord:  7,
	Name: `G`,
}
View Source
var G_FLAT = Note{
	Ord:  6,
	Name: `G♭`,
}
View Source
var G_FLAT_MAJOR = Scale{

	Name:        `G♭ major`,
	Accidentals: -6,
	Type:        Major,
	Notes:       []Note{G_FLAT, A_FLAT, B_FLAT, C_FLAT, D_FLAT, E_FLAT, F},
	// contains filtered or unexported fields
}

enharmonic to F# major

View Source
var G_MAJOR = Scale{

	Name:        `G major`,
	Accidentals: 1,
	Type:        Major,
	Notes:       []Note{G, A, B, C, D, E, F_SHARP},
	// contains filtered or unexported fields
}
View Source
var G_MINOR = Scale{

	Name:        `G minor`,
	Accidentals: -2,
	Type:        Minor,
	Notes:       []Note{G, A, B_FLAT, C, D, E_FLAT, F},
	// contains filtered or unexported fields
}
View Source
var G_SHARP = Note{
	Ord:  8,
	Name: `G♯`,
}
View Source
var G_SHARP_MINOR = Scale{

	Name:        `G♯ minor`,
	Accidentals: 5,
	Type:        Minor,
	Notes:       []Note{G_SHARP, A_SHARP, B, C_SHARP, D_SHARP, E, F_SHARP},
	// contains filtered or unexported fields
}
View Source
var SCALE = []Note{
	C, C_SHARP, D, D_SHARP, E, F, F_SHARP, G, G_SHARP, A, A_SHARP, B,
}

Functions

func AddManufacturers

func AddManufacturers(list map[string]Manufacturer)

func LoadManufacturers

func LoadManufacturers(r io.Reader) (map[string]Manufacturer, error)

Types

type Channel

type Channel uint8

func ParseChannel

func ParseChannel(s string) (Channel, error)

func (Channel) MarshalJSON

func (c Channel) MarshalJSON() ([]byte, error)

func (Channel) String

func (c Channel) String() string

func (*Channel) UnmarshalJSON

func (c *Channel) UnmarshalJSON(bytes []byte) error

func (*Channel) UnmarshalText

func (c *Channel) UnmarshalText(bytes []byte) error

type Controller

type Controller struct {
	ID   byte   `json:"id"`
	Name string `json:"name"`
}

func LookupController

func LookupController(id byte) Controller

type Delta

type Delta uint32

func DecodeDelta

func DecodeDelta(r io.ByteReader) (Delta, error)

func ParseDelta

func ParseDelta(s string) (Delta, error)

func (Delta) MarshalBinary

func (d Delta) MarshalBinary() ([]byte, error)

func (Delta) String

func (d Delta) String() string

type Hex

type Hex []byte

func ParseHex

func ParseHex(s string) (Hex, error)

func (Hex) MarshalBinary

func (h Hex) MarshalBinary() ([]byte, error)

func (Hex) MarshalJSON

func (h Hex) MarshalJSON() ([]byte, error)

func (Hex) String

func (bytes Hex) String() string

func (*Hex) UnmarshalJSON

func (h *Hex) UnmarshalJSON(bytes []byte) error

type KeyType

type KeyType uint8
const (
	Major KeyType = 0
	Minor KeyType = 1
)

func (KeyType) String

func (k KeyType) String() string

type Manufacturer

type Manufacturer struct {
	ID     []byte `json:"id"`
	Region string `json:"region"`
	Name   string `json:"name"`
}

func FindManufacturer

func FindManufacturer(s string) (Manufacturer, error)

func LookupManufacturer

func LookupManufacturer(id []byte) Manufacturer

func (Manufacturer) MarshalJSON

func (m Manufacturer) MarshalJSON() ([]byte, error)

func (*Manufacturer) UnmarshalJSON

func (m *Manufacturer) UnmarshalJSON(bytes []byte) error

type MetaEventType

type MetaEventType byte
const (
	TypeSequenceNumber         MetaEventType = 0x00
	TypeText                   MetaEventType = 0x01
	TypeCopyright              MetaEventType = 0x02
	TypeTrackName              MetaEventType = 0x03
	TypeInstrumentName         MetaEventType = 0x04
	TypeLyric                  MetaEventType = 0x05
	TypeMarker                 MetaEventType = 0x06
	TypeCuePoint               MetaEventType = 0x07
	TypeProgramName            MetaEventType = 0x08
	TypeDeviceName             MetaEventType = 0x09
	TypeMIDIChannelPrefix      MetaEventType = 0x20
	TypeMIDIPort               MetaEventType = 0x21
	TypeTempo                  MetaEventType = 0x51
	TypeSMPTEOffset            MetaEventType = 0x54
	TypeTimeSignature          MetaEventType = 0x58
	TypeKeySignature           MetaEventType = 0x59
	TypeEndOfTrack             MetaEventType = 0x2f
	TypeSequencerSpecificEvent MetaEventType = 0x7f
)

func (MetaEventType) Equals

func (t MetaEventType) Equals(b byte) bool

func (MetaEventType) String

func (t MetaEventType) String() string

type MiddleC

type MiddleC int

Ref. https://computermusicresource.com/midikeys.html

const (
	C3 MiddleC = iota
	C4
)

func (*MiddleC) Set

func (c *MiddleC) Set(s string) error

func (MiddleC) String

func (c MiddleC) String() string

type MidiEventType

type MidiEventType byte
const (
	TypeNoteOff            MidiEventType = 0x80
	TypeNoteOn             MidiEventType = 0x90
	TypePolyphonicPressure MidiEventType = 0xa0
	TypeController         MidiEventType = 0xb0
	TypeProgramChange      MidiEventType = 0xc0
	TypeChannelPressure    MidiEventType = 0xd0
	TypePitchBend          MidiEventType = 0xe0
)

func (MidiEventType) Equals

func (t MidiEventType) Equals(b byte) bool

func (MidiEventType) String

func (t MidiEventType) String() string

type Note

type Note struct {
	Ord  int
	Name string
}

func LookupNote

func LookupNote(s string) (Note, error)

func (Note) String

func (n Note) String() string

type Scale

type Scale struct {
	Name        string
	Accidentals int8
	Type        KeyType
	Notes       []Note
	// contains filtered or unexported fields
}

func MajorScale

func MajorScale(accidentals int8) (Scale, bool)

func MinorScale

func MinorScale(accidentals int8) (Scale, bool)

func (Scale) Transpose

func (s Scale) Transpose(steps int) Scale

type ScaleID

type ScaleID int
const (
	CMajor ScaleID = iota
	GMajor
	DMajor
	AMajor
	EMajor
	BMajor
	FSharpMajor
	CSharpMajor
	FMajor
	BFlatMajor
	EFlatMajor
	AFlatMajor
	DFlatMajor
	GFlatMajor
	CFlatMajor

	AMinor
	EMinor
	BMinor
	ASharpMinor
	DSharpMinor
	GSharpMinor
	CSharpMinor
	FSharpMinor
	DMinor
	GMinor
	CMinor
	FMinor
	BFlatMinor
	EFlatMinor
	AFlatMinor
)

type Status

type Status byte

func (Status) String

func (t Status) String() string

type SysExEventType

type SysExEventType byte
const (
	TypeSysExMessage             SysExEventType = 0xf0
	TypeSysExContinuationMessage SysExEventType = 0xf7
	TypeSysExEscapeMessage       SysExEventType = 0xf7
)

func (SysExEventType) Equals

func (t SysExEventType) Equals(b byte) bool

func (SysExEventType) String

func (t SysExEventType) String() string

type TEventType

type TEventType interface {
	MetaEventType | MidiEventType | SysExEventType

	Equals(byte) bool
}

type Tag

type Tag int
const (
	TagUnknown Tag = iota
	TagSequenceNumber
	TagText
	TagCopyright
	TagTrackName
	TagInstrumentName
	TagLyric
	TagMarker
	TagCuePoint
	TagProgramName
	TagDeviceName
	TagMIDIChannelPrefix
	TagMIDIPort
	TagTempo
	TagSMPTEOffset
	TagTimeSignature
	TagKeySignature
	TagEndOfTrack
	TagSequencerSpecificEvent

	TagChannelPressure
	TagController
	TagNoteOff
	TagNoteOn
	TagPitchBend
	TagPolyphonicPressure
	TagProgramChange
	TagSysExContinuation
	TagSysExEscape
	TagSysExMessage
)

func (Tag) String

func (t Tag) String() string

func (*Tag) UnmarshalText

func (t *Tag) UnmarshalText(bytes []byte) error

type TrackNumber

type TrackNumber uint

func (TrackNumber) String

func (t TrackNumber) String() string

type VLF

type VLF []byte

func (VLF) MarshalBinary

func (v VLF) MarshalBinary() ([]byte, error)

type VLQ

type VLQ uint32

func (VLQ) MarshalBinary

func (v VLQ) MarshalBinary() ([]byte, error)

Jump to

Keyboard shortcuts

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