meta

package
v1.23.7 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 9 Imported by: 10

Documentation

Overview

Package meta provides MIDI Meta Messages

Index

Constants

View Source
const (
	// EndOfTrack represents the end of track MIDI message. It must be written at the end of a track
	EndOfTrack = endOfTrack(true)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel added in v1.7.0

type Channel uint8

Channel represents the deprecated MIDI channel meta message

func (Channel) Number added in v1.7.0

func (m Channel) Number() uint8

Number returns the number of the MIDI channel (starting with 0)

func (Channel) Raw added in v1.7.0

func (m Channel) Raw() []byte

Raw returns the raw bytes for the message

func (Channel) String added in v1.7.0

func (m Channel) String() string

String represents the MIDIChannel message as a string (for debugging)

type Copyright string

Copyright represents the MIDI copyright message

func (Copyright) Raw

func (m Copyright) Raw() []byte

Raw returns the raw MIDI data

func (Copyright) String

func (m Copyright) String() string

String returns the copyright message as a string (for debugging)

func (Copyright) Text

func (m Copyright) Text() string

Text returns the copyright text

type Cuepoint

type Cuepoint string

Cuepoint represents a MIDI cue point message

func (Cuepoint) Raw

func (m Cuepoint) Raw() []byte

Raw returns the raw MIDI bytes

func (Cuepoint) String

func (m Cuepoint) String() string

String represents the cue point MIDI message as a string (for debugging)

func (Cuepoint) Text

func (m Cuepoint) Text() string

Text returns the text of the cue point

type Device added in v1.7.0

type Device string

Device represents a MIDI device point message

func (Device) Raw added in v1.7.0

func (m Device) Raw() []byte

Raw returns the raw MIDI data

func (Device) String added in v1.7.0

func (m Device) String() string

String represents the device point MIDI message as a string (for debugging)

func (Device) Text added in v1.7.0

func (m Device) Text() string

Text returns the name of the device port

type Instrument added in v1.9.0

type Instrument string

Instrument represents the MIDI instrument name message

func (Instrument) Raw added in v1.9.0

func (m Instrument) Raw() []byte

Raw returns the raw MIDI data

func (Instrument) String added in v1.9.0

func (m Instrument) String() string

String repesents the MIDI track message as a string (for debugging)

func (Instrument) Text added in v1.9.0

func (m Instrument) Text() string

Text returns the name of the track

type Key added in v1.7.0

type Key struct {
	Key     uint8
	IsMajor bool
	Num     uint8
	//	SharpsOrFlats int8
	IsFlat bool
}

Key sets the key/scale of the SMF file. If you want a more comfortable way to set the key, use the key subpackage.

func (Key) Note added in v1.7.0

func (m Key) Note() (note string)

Note returns the note of the key signature as a string, e.g. C♯ or E♭

func (Key) Raw added in v1.7.0

func (m Key) Raw() []byte

Raw returns the raw MIDI data

func (Key) String added in v1.7.0

func (m Key) String() string

String represents the key signature message as a string (for debugging)

func (Key) Text added in v1.7.0

func (m Key) Text() string

Text returns a the text of the key signature

type Lyric

type Lyric string

Lyric represents a lyric MIDI message

func (Lyric) Raw

func (m Lyric) Raw() []byte

Raw returns the raw MIDI data

func (Lyric) String

func (m Lyric) String() string

String represents the lyric message as a string (for debugging)

func (Lyric) Text

func (m Lyric) Text() string

Text returns the text of the lyric

type Marker

type Marker string

Marker represents a MIDI marker message

func (Marker) Raw

func (m Marker) Raw() []byte

Raw returns the raw MIDI data

func (Marker) String

func (m Marker) String() string

String represents the marker MIDI message as a string (for debugging)

func (Marker) Text

func (m Marker) Text() string

Text returns the text of the marker

type Message

type Message interface {
	String() string
	Raw() []byte
	// contains filtered or unexported methods
}

Message is a MIDI meta message

type Port added in v1.7.0

type Port uint8

Port represents the deprecated MIDI port message

func (Port) Number added in v1.7.0

func (m Port) Number() uint8

Number returns the number of the port

func (Port) Raw added in v1.7.0

func (m Port) Raw() []byte

Raw returns the raw MIDI data

func (Port) String added in v1.7.0

func (m Port) String() string

String represents the MIDI port message as a string (for debugging)

type Program added in v1.7.0

type Program string

Program represents a MIDI program name

func (Program) Raw added in v1.7.0

func (p Program) Raw() []byte

Raw returns the raw bytes for the message

func (Program) String added in v1.7.0

func (p Program) String() string

String represents the MIDI program name message as a string (for debugging)

func (Program) Text added in v1.7.0

func (p Program) Text() string

Text returns the program name

type Reader

type Reader interface {
	// Read reads a single Meta Message.
	// It may just be called once per Reader. A second call returns io.EOF
	Read() (Message, error)
}

Reader reads a Meta Message

func NewReader

func NewReader(input io.Reader, typ byte) Reader

NewReader returns a reader that can read a single Meta Message Read may just be called once per Reader. A second call returns io.EOF

type SMPTE added in v1.7.0

type SMPTE struct {
	Hour            byte
	Minute          byte
	Second          byte
	Frame           byte
	FractionalFrame byte
}

SMPTE represents a smpte offset MIDI meta message

func (SMPTE) Raw added in v1.7.0

func (s SMPTE) Raw() []byte

Raw returns the raw bytes for the message

func (SMPTE) String added in v1.7.0

func (s SMPTE) String() string

String represents the smpte offset MIDI message as a string (for debugging)

type SequenceNo added in v1.7.0

type SequenceNo uint16

SequenceNo represents the sequence number MIDI meta message

func (SequenceNo) Number added in v1.7.0

func (s SequenceNo) Number() uint16

Number returns the number of the sequence

func (SequenceNo) Raw added in v1.7.0

func (s SequenceNo) Raw() []byte

Raw returns the raw bytes for the message

func (SequenceNo) String added in v1.7.0

func (s SequenceNo) String() string

String represents the MIDI sequence name message as a string (for debugging)

type SequencerData added in v1.7.0

type SequencerData []byte

SequencerData is a sequencer specific meta message

func (SequencerData) Data added in v1.7.0

func (s SequencerData) Data() []byte

Data returns the sequencer specific data

func (SequencerData) Len added in v1.7.0

func (s SequencerData) Len() int

Len returns the length of the sequencer specific data

func (SequencerData) Raw added in v1.7.0

func (s SequencerData) Raw() []byte

Raw returns the raw MIDI data

func (SequencerData) String added in v1.7.0

func (s SequencerData) String() string

String represents the sequencer spefici MIDI message as a string (for debugging)

type Tempo

type Tempo uint32

Tempo represents a MIDI tempo (change) message in microseconds per crotchet

func BPM added in v1.7.0

func BPM(bpm uint32) Tempo

BPM returns the meta tempo message that corresponds to the given bpm (beats per minute) value

func FractionalBPM added in v1.7.0

func FractionalBPM(fbpm float64) Tempo

FractionalBPM returns the meta tempo message that corresponds to the given fractional bpm (beats per minute) value

func (Tempo) BPM

func (m Tempo) BPM() uint32

BPM returns the tempo in beats per minute

func (Tempo) FractionalBPM added in v1.7.0

func (m Tempo) FractionalBPM() float64

FractionalBPM returns the tempo in fractional beats per minute

func (Tempo) MuSecPerQN added in v1.7.0

func (m Tempo) MuSecPerQN() uint32

MuSecPerQN returns the tempo in microseconds per quarternote

func (Tempo) Raw

func (m Tempo) Raw() []byte

Raw returns the raw MIDI data

func (Tempo) String

func (m Tempo) String() string

String represents the tempo message as a string (for debugging)

type Text

type Text string

Text is a MIDI text meta message

func (Text) Raw

func (m Text) Raw() []byte

Raw returns the raw bytes for the message

func (Text) String

func (m Text) String() string

String represents the MIDI text message as a string (for debugging)

func (Text) Text

func (m Text) Text() string

Text returns the text within the message

type TimeSig added in v1.7.0

type TimeSig struct {
	Numerator                uint8
	Denominator              uint8
	ClocksPerClick           uint8
	DemiSemiQuaverPerQuarter uint8
}

TimeSig sets the time signature according to the SMF spec. Denominator isn't a power of 2, but a readable decimal number (uint8). If you want an easy way without having to worry about ClocksPerClick and DemiSemiQuaverPerQuarter, use the meter subpackage.

func (TimeSig) Raw added in v1.7.0

func (m TimeSig) Raw() []byte

Raw returns the raw MIDI data

func (TimeSig) Signature added in v1.7.0

func (m TimeSig) Signature() string

Signature returns the time signature in a readable way

func (TimeSig) String added in v1.7.0

func (m TimeSig) String() string

String represents the time signature MIDI message as a string (for debugging)

type TrackSequenceName added in v1.9.0

type TrackSequenceName string

TrackSequenceName represents a MIDI track name/sequence name message If in a format 0 track, or the first track in a format 1 file, the name of the sequence. Otherwise, the name of the track.

func (TrackSequenceName) Raw added in v1.9.0

func (m TrackSequenceName) Raw() []byte

Raw returns the raw bytes for the message

func (TrackSequenceName) String added in v1.9.0

func (m TrackSequenceName) String() string

String represents the MIDI track/sequence name message as a string (for debugging)

func (TrackSequenceName) Text added in v1.9.0

func (m TrackSequenceName) Text() string

Text returns the name

type Undefined

type Undefined struct {
	Typ  byte
	Data []byte
}

Undefined represents an undefined meta message

func (Undefined) Raw

func (m Undefined) Raw() []byte

Raw returns the raw MIDI data

func (Undefined) String

func (m Undefined) String() string

String represents the undefined meta message as a string (for debugging)

Directories

Path Synopsis
Package key provides helper functions for key signature meta messages.
Package key provides helper functions for key signature meta messages.
Package meter provides helper functions for time signature meta messages.
Package meter provides helper functions for time signature meta messages.

Jump to

Keyboard shortcuts

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