midi

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// message types
	NoteOff               uint8 = 0b1000 << 4
	NoteOn                uint8 = 0b1001 << 4
	PolyphonicKeyPressure uint8 = 0b1010 << 4 // After-touch
	ControlChange         uint8 = 0b1011 << 4
	ProgramChange         uint8 = 0b1100 << 4
	ChannelPressure       uint8 = 0b1101 << 4 // After-touch
	PitchWheelChange      uint8 = 0b1110 << 4

	// ControlChange
	AllNotesOff         uint8 = 0b01111011
	AllSoundOff         uint8 = 0b01111000
	ResetAllControllers uint8 = 0b01111001

	// System real-time
	TimingClock    uint8 = 0b11111000
	TimingStart    uint8 = 0b11111010
	TimingContinue uint8 = 0b11111011
	TimingStop     uint8 = 0b11111100
)

Variables

View Source
var IntervalToString = map[int]string{
	0:  "Perfect unison",
	1:  "Minor second",
	2:  "Major second",
	3:  "Minor third",
	4:  "Major third",
	5:  "Perfect fourth",
	6:  "Tritone",
	7:  "Perfect fifth",
	8:  "Minor sixth",
	9:  "Major sixth",
	10: "Minor seventh",
	11: "Major seventh",
	12: "Perfect octave",
}

Functions

func ProcessMidiEvents

func ProcessMidiEvents(ctx context.Context, port driver.Port,
	midiEventsOut <-chan Event, midiEventsIn chan<- Event,
	score *Score)

Types

type Event

type Event []byte

func ControlChangeEvent

func ControlChangeEvent(channel, function, value uint8) Event

func NoteEvent

func NoteEvent(messageType, channel, note, velocity uint8) Event

func PitchBendEvent

func PitchBendEvent(channel uint8, val float64) Event

PitchBendEvent accepts a value in range -1.0 to 1.0

func (Event) Channel

func (e Event) Channel() uint8

func (Event) Note

func (e Event) Note() uint8

Note - make sure event type is NoteOn/NoteOff before call

func (Event) String

func (e Event) String() string

func (Event) Type

func (e Event) Type() uint8

type Score

type Score struct {
	Score             uint
	MidiEventsEmitted uint
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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