Documentation ¶
Overview ¶
Package channel provides MIDI Channel Messages
Index ¶
- Constants
- type Aftertouch
- type Channel
- func (c Channel) Aftertouch(pressure uint8) Aftertouch
- func (c Channel) Channel() uint8
- func (c Channel) ControlChange(controller uint8, value uint8) ControlChange
- func (c Channel) NoteOff(key uint8) NoteOff
- func (c Channel) NoteOffVelocity(key uint8, velocity uint8) NoteOffVelocity
- func (c Channel) NoteOn(key uint8, velocity uint8) NoteOn
- func (c Channel) Pitchbend(value int16) Pitchbend
- func (c Channel) PolyAftertouch(key uint8, pressure uint8) PolyAftertouch
- func (c Channel) ProgramChange(program uint8) ProgramChange
- type ControlChange
- type Message
- type NoteOff
- type NoteOffVelocity
- type NoteOn
- type Pitchbend
- type PolyAftertouch
- type ProgramChange
- type Reader
- type ReaderOption
Constants ¶
const ( // PitchReset is the pitch bend value to reset the pitch wheel to zero PitchReset = 0 // PitchLowest is the lowest possible value of the pitch bending PitchLowest = -8192 // PitchHighest is the highest possible value of the pitch bending PitchHighest = 8191 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aftertouch ¶ added in v1.7.0
type Aftertouch struct {
// contains filtered or unexported fields
}
Aftertouch represents a MIDI aftertouch message (aka "channel pressure")
func (Aftertouch) Channel ¶ added in v1.7.0
func (a Aftertouch) Channel() uint8
Channel returns the channel of the aftertouch message.
func (Aftertouch) Pressure ¶ added in v1.7.0
func (a Aftertouch) Pressure() uint8
Pressure returns the pressure of the aftertouch message.
func (Aftertouch) Raw ¶ added in v1.7.0
func (a Aftertouch) Raw() []byte
Raw returns the raw bytes of the aftertouch message.
func (Aftertouch) String ¶ added in v1.7.0
func (a Aftertouch) String() string
String returns human readable information about the aftertouch message.
type Channel ¶
type Channel uint8
Channel represents a MIDI channel there must not be more than 16 MIDI channels (0-15)
const ( // MIDI channel 1 Channel0 Channel = iota // MIDI channel 2 Channel1 // MIDI channel 3 Channel2 // MIDI channel 4 Channel3 // MIDI channel 5 Channel4 // MIDI channel 6 Channel5 // MIDI channel 7 Channel6 // MIDI channel 8 Channel7 // MIDI channel 9 Channel8 // MIDI channel 10 Channel9 // MIDI channel 11 Channel10 // MIDI channel 12 Channel11 // MIDI channel 13 Channel12 // MIDI channel 14 Channel13 // MIDI channel 15 Channel14 // MIDI channel 16 Channel15 )
func (Channel) Aftertouch ¶ added in v1.7.0
func (c Channel) Aftertouch(pressure uint8) Aftertouch
Aftertouch creates an aftertouch message on the channel
func (Channel) ControlChange ¶
func (c Channel) ControlChange(controller uint8, value uint8) ControlChange
ControlChange creates a control change message on the channel
func (Channel) NoteOff ¶
NoteOff creates a note-off message on the channel for the given key The note-off message is "faked" by a note-on message of velocity 0. This allows saving bandwidth by using running status. If you need a "real" note-off message with velocity, use NoteOffVelocity.
func (Channel) NoteOffVelocity ¶
func (c Channel) NoteOffVelocity(key uint8, velocity uint8) NoteOffVelocity
NoteOffVelocity creates a note-off message with velocity on the channel.
func (Channel) PolyAftertouch ¶ added in v1.7.0
func (c Channel) PolyAftertouch(key uint8, pressure uint8) PolyAftertouch
PolyAftertouch creates a polyphonic aftertouch message on the channel
func (Channel) ProgramChange ¶
func (c Channel) ProgramChange(program uint8) ProgramChange
ProgramChange creates a program change message on the channel
type ControlChange ¶
type ControlChange struct {
// contains filtered or unexported fields
}
ControlChange represents a MIDI control change message
func (ControlChange) Channel ¶
func (c ControlChange) Channel() uint8
Channel returns the MIDI channel of the control change message
func (ControlChange) Controller ¶
func (c ControlChange) Controller() uint8
Controller returns the controller of the control change message
func (ControlChange) Raw ¶
func (c ControlChange) Raw() []byte
Raw returns the raw bytes of the control change message.
func (ControlChange) String ¶
func (c ControlChange) String() string
String returns human readable information about the control change message.
func (ControlChange) Value ¶
func (c ControlChange) Value() uint8
Value returns the value of the control change message
type NoteOff ¶
type NoteOff struct {
// contains filtered or unexported fields
}
NoteOff represents a note-off message by a note-on message with velocity of 0 (helps for running status). This is the normal way to go. If you need the velocity of a note-off message, use NoteOffVelocity.
type NoteOffVelocity ¶
type NoteOffVelocity struct { NoteOff // contains filtered or unexported fields }
NoteOffVelocity is offered as an alternative to NoteOff for a "real" noteoff message (type 8) that has velocity.
func (NoteOffVelocity) Raw ¶
func (n NoteOffVelocity) Raw() []byte
Raw returns the bytes for the noteoff message. Since NoteOff.Raw() returns in fact a noteon message (type 9) with velocity of 0 to allow running status, NoteOffPedantic.Raw() is offered as an alternative to make sure a "real" noteoff message (type 8) is returned.
func (NoteOffVelocity) String ¶
func (n NoteOffVelocity) String() string
String returns human readable information about the note-off message that includes velocity.
func (NoteOffVelocity) Velocity ¶
func (n NoteOffVelocity) Velocity() uint8
Velocity returns the velocity of the note-off message
type NoteOn ¶
type NoteOn struct {
// contains filtered or unexported fields
}
NoteOn represents a note-on message
type Pitchbend ¶ added in v1.7.0
type Pitchbend struct {
// contains filtered or unexported fields
}
Pitchbend represents a pitch bend message (aka "Portamento").
func (Pitchbend) AbsValue ¶ added in v1.7.0
AbsValue returns the absolute value (14bit) of the pitch bending (unsigned)
type PolyAftertouch ¶ added in v1.7.0
type PolyAftertouch struct {
// contains filtered or unexported fields
}
PolyAftertouch represents a MIDI polyphonic aftertouch message (aka "key pressure")
func (PolyAftertouch) Channel ¶ added in v1.7.0
func (p PolyAftertouch) Channel() uint8
Channel returns the channel of the polyphonic aftertouch message
func (PolyAftertouch) Key ¶ added in v1.7.0
func (p PolyAftertouch) Key() uint8
Key returns the key of the polyphonic aftertouch message
func (PolyAftertouch) Pressure ¶ added in v1.7.0
func (p PolyAftertouch) Pressure() uint8
Pressure returns the pressure of the polyphonic aftertouch message
func (PolyAftertouch) Raw ¶ added in v1.7.0
func (p PolyAftertouch) Raw() []byte
Raw returns the raw bytes of the polyphonic aftertouch message.
func (PolyAftertouch) String ¶ added in v1.7.0
func (p PolyAftertouch) String() string
String returns human readable information about the polyphonic aftertouch message.
type ProgramChange ¶
type ProgramChange struct {
// contains filtered or unexported fields
}
ProgramChange represents a MIDI program change message
func (ProgramChange) Channel ¶
func (p ProgramChange) Channel() uint8
Channel returns the channel of the program change message.
func (ProgramChange) Program ¶
func (p ProgramChange) Program() uint8
Program returns the program of the program change message.
func (ProgramChange) Raw ¶
func (p ProgramChange) Raw() []byte
Raw returns the raw bytes of the program change message.
func (ProgramChange) String ¶
func (p ProgramChange) String() string
String returns human readable information about the program change message.
type Reader ¶
type Reader interface { // Read reads a single channel message. // It may just be called once per Reader. A second call returns io.EOF Read(status, arg1 byte) (Message, error) }
Reader read a channel message
type ReaderOption ¶
type ReaderOption func(*reader)
ReaderOption is an option for the channel reader.
func ReadNoteOffVelocity ¶
func ReadNoteOffVelocity() ReaderOption
ReadNoteOffVelocity lets the reader differentiate between "fake" noteoff messages (which are in fact noteon messages (typ 9) with velocity of 0) and "real" noteoff messages (typ 8) with own velocity. The former are returned as NoteOffVelocity messages and keep the given velocity, the later are returned as NoteOff messages without velocity. That means in order to get all noteoff messages, there must be checks for NoteOff and NoteOffVelocity (if this option is set). If this option is not set, both kinds are returned as NoteOff (default).