Documentation
¶
Overview ¶
package midi
Index ¶
- Variables
- func MetaChannel(ch uint8) []byte
- func MetaCopyright(text string) []byte
- func MetaCuepoint(text string) []byte
- func MetaDevice(text string) []byte
- func MetaInstrument(text string) []byte
- func MetaKey(key uint8, isMajor bool, num uint8, isFlat bool) []byte
- func MetaLyric(text string) []byte
- func MetaMarker(text string) []byte
- func MetaMessage(typ byte, data []byte) []byte
- func MetaMeter(num, denom uint8) []byte
- func MetaPort(p uint8) []byte
- func MetaProgram(text string) []byte
- func MetaSMPTE(hour, minute, second, frame, fractionalFrame byte) []byte
- func MetaSequenceNo(no uint16) []byte
- func MetaSequencerData(data []byte) []byte
- func MetaTempo(bpm float64) []byte
- func MetaText(text string) []byte
- func MetaTimeSig(numerator, denominator, clocksPerClick, demiSemiQuaverPerQuarter uint8) []byte
- func MetaTrackSequenceName(text string) []byte
- func MetaUndefined(typ byte, data []byte) []byte
- func ReadMetaData(tp MsgType, rd io.Reader) (data []byte, err error)
- func SysEx(msg []byte) []byte
- type Channel
- func (ch Channel) Aftertouch(pressure uint8) []byte
- func (ch Channel) ControlChange(controller, value uint8) []byte
- func (ch Channel) Index() uint8
- func (ch Channel) NoteOff(key uint8) []byte
- func (ch Channel) NoteOffVelocity(key, velocity uint8) []byte
- func (ch Channel) NoteOn(key, velocity uint8) []byte
- func (ch Channel) Pitchbend(value int16) []byte
- func (ch Channel) PolyAftertouch(key, pressure uint8) []byte
- func (ch Channel) ProgramChange(program uint8) []byte
- type Driver
- type In
- type Message
- func (m Message) BPM() float64
- func (m Message) Change() int8
- func (m Message) Channel() int8
- func (m Message) Controller() int8
- func (m Message) IsNoteEnd() bool
- func (m Message) IsNoteStart() bool
- func (m Message) Key() int8
- func (m Message) Meter() (num, denom uint8)
- func (m Message) Pitch() (relative int16, absolute int16)
- func (m Message) Pressure() int8
- func (m Message) Program() int8
- func (m Message) String() string
- func (m Message) Text() string
- func (m Message) TimeSig() (numerator, denominator, clocksPerClick, demiSemiQuaverPerQuarter uint8)
- func (m Message) Velocity() int8
- type MsgType
- func (m MsgType) Clear(flag MsgType) MsgType
- func (m MsgType) Is(flag MsgType) bool
- func (m MsgType) IsAllOf(flags ...MsgType) bool
- func (m MsgType) IsNot(flag MsgType) bool
- func (m MsgType) IsOneOf(flags ...MsgType) bool
- func (m MsgType) Set(flag MsgType) MsgType
- func (m MsgType) String() string
- func (m MsgType) Toggle(flag MsgType) MsgType
- type Out
- type Port
- type Receiver
- type Sender
- type SenderTo
Constants ¶
This section is empty.
Variables ¶
var EOT = MetaMessage(byteEndOfTrack, nil)
EndOfTrack you should not use this. Use the smf package instead.
var ErrPortClosed = fmt.Errorf("ERROR: port is closed")
ErrPortClosed should be returned from a driver when trying to write to a closed port.
Functions ¶
func MetaChannel ¶
func MetaCopyright ¶
func MetaCuepoint ¶
func MetaDevice ¶
func MetaInstrument ¶
func MetaMarker ¶
func MetaMessage ¶
func MetaProgram ¶
func MetaSequenceNo ¶
func MetaSequencerData ¶
func MetaTimeSig ¶
Raw returns the raw MIDI data
func MetaTrackSequenceName ¶
func MetaUndefined ¶
Types ¶
type Channel ¶
type Channel uint8
func (Channel) Aftertouch ¶
Aftertouch returns the bytes of an aftertouch message.
func (Channel) ControlChange ¶
ControlChange returns the bytes of an control change message.
func (Channel) NoteOffVelocity ¶
func (Channel) PolyAftertouch ¶
PolyAftertouch returns the raw bytes of the polyphonic aftertouch message.
func (Channel) ProgramChange ¶
type Driver ¶
type Driver interface { // Ins returns the available MIDI input ports. Ins() ([]In, error) // Outs returns the available MIDI output ports. Outs() ([]Out, error) // String returns the name of the driver. String() string // Close closes the driver. Must be called for cleanup at the end of a session. Close() error }
Driver is a driver for MIDI connections.
type In ¶
type In interface { Port SenderTo // StopListening stops the listening. // When closing a MIDI input port, StopListening must be called before (from the driver). StopListening() error }
In is an interface for a MIDI input port
type Message ¶
func NewMessage ¶
func ReadChannelMessage ¶
Read reads a channel message
func (Message) Change ¶
Change returns the MIDI controllchange a number from 0 to 127 or -1, if it is no controller message
func (Message) Channel ¶
Channel returns the MIDI channel - a number from 0 to 15 or -1, if it is no channel message or an invalid channel number
func (Message) Controller ¶
Controller returns the MIDI controller - a number from 0 to 127 or -1, if it is no controller message
func (Message) IsNoteEnd ¶
IsNoteEnd checks, if we have a de facto note end, i.e. a NoteoffMsg or a NoteOnMsg with velocity == 0
func (Message) IsNoteStart ¶
IsNoteStart checks, if we have a de facto note start, i.e. a NoteOnMsg with velocity > 0
func (Message) Key ¶
Key returns the MIDI key - a number from 0 to 127 or -1, if it is no noteOn / noteOff / PolyAfterTouch message or an invalid key
func (Message) Text ¶
Text returns the text for the meta messages
Lyric Copyright Cuepoint Device Instrument Marker Program Text TrackSequenceName
type MsgType ¶
type MsgType uint64
const ( ChannelMsg MsgType = 1 << iota MetaMsg RealTimeMsg SysCommonMsg SysExMsg NoteOnMsg NoteOffMsg ControlChangeMsg PitchBendMsg AfterTouchMsg PolyAfterTouchMsg ProgramChangeMsg MetaChannelMsg MetaCopyrightMsg MetaCuepointMsg MetaDeviceMsg MetaEndOfTrackMsg MetaInstrumentMsg MetaKeySigMsg MetaLyricMsg MetaTextMsg MetaMarkerMsg MetaPortMsg MetaSeqNumberMsg MetaSeqDataMsg MetaTempoMsg MetaTimeSigMsg MetaTrackNameMsg MetaSMPTEOffsetMsg MetaUndefinedMsg MetaProgramNameMsg TimingClockMsg TickMsg StartMsg ContinueMsg StopMsg ActiveSenseMsg ResetMsg SysExStartMsg SysExEndMsg SysExCompleteMsg SysExEscapeMsg SysExContinueMsg MTCMsg SongSelectMsg SPPMsg UndefinedMsg TuneMsg Channel0Msg Channel1Msg Channel2Msg Channel3Msg Channel4Msg Channel5Msg Channel6Msg Channel7Msg Channel8Msg Channel9Msg Channel10Msg Channel11Msg Channel12Msg Channel13Msg Channel14Msg Channel15Msg )
const UnknownMsg MsgType = 0
func GetMetaMessage ¶
func GetMsgType ¶
type Port ¶
type Port interface { // Open opens the MIDI port. An implementation should save the open state to make it // save to call open when the port is already open without getting an error. Open() error // Close closes the MIDI port. An implementation should save the open state to make it // save to call close when the port is already closed without getting an error. Close() error // IsOpen returns wether the MIDI port is open. IsOpen() bool // Number returns the number of the MIDI port. It is only guaranteed that the numbers are unique within // MIDI port groups i.e. within MIDI input ports and MIDI output ports. So there may be the same number // for a given MIDI input port and some MIDI output port. Or not - that depends on the underlying driver. Number() int // String represents the MIDI port by a string, aka name. String() string // Underlying returns the underlying driver to allow further adjustments. // When using the underlying driver, the user must take care of proper opening/closing etc. Underlying() interface{} }
Port is an interface for a MIDI port.
type Receiver ¶
type Receiver interface { // Receive receives a MIDI message. deltamicrosec is the delta to the previous note in microseconds (^-6) Receive(msg []byte, deltamicrosec int64) }
Receiver receives MIDI messages.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
drivers
|
|
testdrv
Package testdrv provides a gomidi/midi.Driver for testing.
|
Package testdrv provides a gomidi/midi.Driver for testing. |
midicatdrv
Module
|
|
portmididrv
Module
|
|
rtmididrv
Module
|
|
rtmididrv/imported/rtmidi
Module
|
|
webmididrv
Module
|
|
webmididrv/example
Module
|
|
listports
Module
|
|
logger
Module
|
|
simple
Module
|
|
smf0player
Module
|
|
smf0recorder
Module
|
|
smfplayer
Module
|
|
smfrecorder
Module
|
|
internal
|
|
tools
|
|
midicat/cmd/midicat
Module
|
|
midispy
Module
|
|
midispy/cmd/midispy
Module
|
|
smflyrics
Module
|