Hello
I am learning C++ and want do something with midi. My idea is recieve midi (usb) and send midi in to DAW. My program will have some simple sequencer. I think idea is not so much complicated with external libraries like rtmidi and midifile sapp.
While I reading and searching about midi, there is very little informations about that. There is lot of info about sending notes etc.. but I can't find anything serious about playback midi and send notes during playback in to midi out. Or my searching skills are low.
For example, how should I read and send midi out message from midi sequence?
How can I correct and sync time in to music tempo time?
Where can I get this kind of informations? Are there some books, tutorials etc.. about that?
I've read a long time ago (198x-9x) a book titled "midi sequencing in C" by Jim Conger, addressing all your questions. It included the source code of a complete MIDI sequencer project, built from scratch.
MIDI is a real-time protocol. The most interesting (and quite easy) aspect of MIDI is receiving and sending MIDI messages in real time. The "rtmidi" library provides exactly that (and nothing more). SMF (Standard MIDI File) is another thing, intended as an interchange format between MIDI sequencers. Parsing SMF is only a minimal part of the problem of creating a MIDI sequencer/player. The "sequencer" part means scheduling the "frozen" MIDI events to OUT ports in the right time. That involves keeping track of time very carefully, and taking into account musical elements like "tempo".
You may find "MIDI Sequencer" functionality (MIDI events scheduling) included in most operating systems, In Windows, look for midiStreamOpen() in mmsystem.h, in macOS you may want to look to MusicPlayer and MusicSequence in the AudioToolbox.framework, and in Linux, ALSA Sequencer offers similar functionality.
Finally, I'm the author of the Drumstick libraries (for Qt/C++), which you can find at Sourceforge. If you are interested in Linux, you will find a complete object-oriented wrapper around the ALSA Sequencer interfaces. Other libraries (multiplatform) are SMF parsing/writing classes (along with other sequencer formats) and realtime MIDI IO. You may also be interested in the source code examples: playsmf (command line) and guiplayer (graphical UI).
http://drumstick.sourceforge.net/docs/playsmf_8cpp-example.html
Regards,
Pedro
Thanks for reply.
I forgot mention I am on windows 7. But in future I want go multiplatform maybe.
Unfortunately book is very old and can't find any pdf form of this book. Btw. I found some website about midi, it can be good for what I am looking for? http://midi.teragonaudio.com/tech/miditech.htm
When I will use windows midiStreamOpen() it is better use only windows midi library for whole project, or it is good mix winows MIDI with RtMidi library as input?