Expand description
Library for developing MIDI Sequencers.
To start using mseq
, create a struct that implements the Conductor
trait.
You can then add tracks to your sequencer by adding fields (to your struct that implements the
Conductor
trait) of type DeteTrack
or more generally fields that implement the trait
Track
.
Once this is done, you can play your track in the Conductor::update
function of your struct
that implements the Conductor
trait. To do so, call the method
MidiController::play_track
(of the Context::midi
) with the track you want to play as a
parameter.
You can find some examples in the examples
directory.
Structs§
- Acid
Trig - Trig used to create acid tracks with
DeteTrack::new_acid
. Each Trig represents one sixteenth step.AcidTrig
provides a similar interface to the originalRoland TB-303
with some slight modifications. - Clock
Div - Struct used in
DeteTrack::new_clock_div
to generate a track with a pattern based on clock divisions. - Context
- An object of type
Context
is passed to the userConductor
at each clock tick through the methodConductor::update
. This structure provides the user with a friendly MIDI interface. The user can set some MIDI System Parameters (e.g.,Context::set_bpm
) or send some MIDI System Messages (e.g.,Context::start
) using directly theContext
methods. The user can also send MIDI Channel Messages (e.g.,MidiController::play_note
orMidiController::play_track
) using the fieldContext::midi
. - Dete
Track - DeteTrack implements the Track trait, so it can be passed to the MidiController to play it. It is defined by a list of notes that will always play at the same time in the track, hence the name (Deterministic Track).
- Midi
Controller - The
MidiController
provides a MIDI interface to the user. - Midi
Note - Note that can be sent through a MIDI message.
Enums§
- ArpDiv
- Time division of the arpeggiator
- MSeq
Error - Error type of mseq
- Note
- Represents 1 note of the chromatic scale.
- Timing
- Timing mostly used in
AcidTrig
to generate acid tracks.
Traits§
- Conductor
- The Conductor trait is the trait that the user has to implement to be able to use mseq. The user
has to implement
Conductor::init
andConductor::update
, then pass the Conductor to the main entry pointcrate::run
. Refer to theseexamples
for complete implementation examples. - Midi
Connection - This trait should not be implemented in the user code. The purpose of this trait is be able to reuse the same code with different midi API, using static dispatch.
- Track
- The Track trait can be implemented by the client. A struct with the Track trait can be passed to the MidiController to play it through a midi connection. This allows to reduce the amount of code in the Conductor by writing each track independently.
Functions§
- param_
value - Perform a linear conversion from
[0.0, 1.0]
to [0, 127]. Ifv
is smaller than0.0
return 0. Ifv
is greater than1.0
return 127. The main purpose of this function is to be used with MIDI control changes (CC). - run
mseq
entry point. Run the sequencer by providing a conductor implementation.port
is the MIDI port id used to send the midi messages. If set toNone
, information about the MIDI ports will be displayed and the output port will be asked to the user with a prompt.