Crate midi_msg[−][src]
This is a library for serializing and deserializing MIDI (byte) streams.
MidiMsg
is the starting point for all MIDI messages. All MidiMsg
s
can be serialized into a valid MIDI sequence. You can create a MidiMsg
and turn it into a Vec<u8>
like so:
use midi_msg::*; MidiMsg::ChannelVoice { channel: Channel::Ch1, msg: ChannelVoiceMsg::NoteOn { note: 60, velocity: 127 } } .to_midi();
See the readme for a list of the MIDI Manufacturer Association documents that are referenced throughout these docs.
Structs
ChannelBitMap | The set of channels to apply this tuning message to. Used by |
ControlChangeControllerDestination | Allows for the selection of the destination of a control change message.
Used by |
ControllerDestination | Allows for the selection of the destination of a channel pressure/poly key pressure message.
Used by |
GlobalParameter | An |
GlobalParameterControl | Global Parameter Control, to control parameters on a device that affect all sound.
E.g. a global reverb.
Used by |
HighResTimeCode | Like |
IdentityReply | A response to |
KeyBasedInstrumentControl | Intended to act like Control Change messages, but targeted at an individual key.
For e.g. Drum sounds that have configurable attack/release/decay per key.
Used by |
KeyBasedTuningDump | Set the tunings of all 128 notes.
Used by |
ManufacturerID | Two 7-bit “bytes”, used to identify the manufacturer for |
ScaleTuning1Byte | Set the tuning of all octaves for a set of channels.
Used by |
ScaleTuning2Byte | Set the high-res tuning of all octaves for a set of channels.
Used by |
ScaleTuningDump1Byte | Set the tuning of all octaves for a tuning program/bank.
Used by |
ScaleTuningDump2Byte | Set the high-res tuning of all octaves for a tuning program/bank.
Used by |
Signature | A time signature. Used by |
SoundFileMap | How to map a |
StandardTimeCode | Like |
StandardUserBits | Like |
TimeCode | Used to synchronize device positions, by |
TimeCodeStatus | Used by |
TimeSignature | Used to communicate a new time signature to the receiver.
Used by |
Tuning | Used to represent a tuning by |
TuningNoteChange | Change the tunings of one or more notes, either real-time or not.
Used by |
UserBits | 32 bits defined by SMPTE for “special functions”. Used in |
WAVMap | How to map a |
Enums
BarMarker | Indicates that the next MIDI clock message is the first clock of a new measure. Which bar
is optionally indicated by this message.
Used by |
BeatValue | The note value of a beat, used by |
Channel | The MIDI channel, 1-16. Used by |
ChannelModeMsg | Channel-level messages that should alter the mode of the receiver. Used in |
ChannelVoiceMsg | Channel-level messages that act on a voice. For instance, turning notes on off,
or modifying sounding notes. Used in |
ChorusType | The type of chorus, used by |
ControlChange | Used by |
ControlNumber | An enum that defines the MIDI numbers associated with Control Changes. |
ControlledParameter | The parameters that can be controlled by |
DeviceID | The device ID being addressed, either a number between 0-126 or |
ExtendedLoopType | The type of loop being described by a |
ExtendedSampleDumpMsg | The extended sample dump messages described in CA-019, used to allow for longer, named samples.
Used by |
FileDumpMsg | Used to transmit general file data.
Used by |
FileReferenceMsg | The set of messages used for accessing files on a shared file system or network
so they can be used to play sounds without transferring the file contents.
Used by |
FileReferenceType | The file type of a given file, as used by |
FileType | A four-character file type used by |
GMPercussionMap | The General MIDI percussion sound to play for a given note number when targeting Channel 10. |
GMSoundSet | The instrument that should be played when applying a |
GeneralMidi | Used to turn General MIDI level 1 or 2 on, or turn them off. |
InformationField | A MIDI Machine Control Information Field, which functions something like an address |
LoopNumber | What loop a |
LoopType | The type of loop being described by a |
MachineControlCommandMsg | A MIDI Machine Control Command.
Used by |
MachineControlResponseMsg | A MIDI Machine Control Response>
Used by |
MidiMsg | The primary interface of this library. Used to encode MIDI messages. |
Parameter | Used by |
PolyMode | Used by |
ReverbType | The type of reverb, used by |
SampleDumpMsg | Used to request and transmit sampler data.
Used by |
SelectMap | How to map a file for MIDI reference. Used by |
ShowControlMsg | A MIDI Show Control command.
Used by |
SlotPath | The “slot” of the device being referred to by |
SubFrames | Used by |
SystemCommonMsg | A fairly limited set of messages, generally for device synchronization.
Used in |
SystemExclusiveMsg | The bulk of the MIDI spec lives here, in “Universal System Exclusive” messages.
Also used for manufacturer-specific messages.
Used in |
SystemRealTimeMsg | A fairly limited set of messages used for device synchronization.
Used in |
TimeCodeCueingMsg | Realtime Time Code Cueing. Used by |
TimeCodeCueingSetupMsg | Non-realtime Time Code Cueing. Used by |
TimeCodeType | Indicates the frame rate of the given |
UniversalNonRealTimeMsg | A diverse range of messages for non-real-time applications. Used by |
UniversalRealTimeMsg | A diverse range of messages for real-time applications. Used by |
Functions
freq_to_midi_note_cents | Given a frequency in Hertz, returns (midi_note_number, additional cents from semitone) |
freq_to_midi_note_float | Given a frequency in Hertz, returns a floating point midi note number with 1.0 = 100 cents |
midi_note_cents_to_freq | Given a midi note number and additional cents, return the frequency |
midi_note_float_to_freq | Given a floating point midi note number, return the frequency in Hertz |