PPQ/FPS and MIDI


#1

Well i’d like to generate midi START/CLOCK/STOP messages based on information from the AudioPlayHead::CurrentPositionInfo struct. And i don’t know how to handle this.

First thing is the PPQ, there are two members that hold some PPQ information, but there is nothing about the PPQ resolution that can vary. In the auio plugin demo i noticed that you multiply position information by 960 is this because you assume that all DAW have this resolution of PPQ?

Also how would i go about generating the midi messages in the most accurate way, i know when to do start/stop but when do i send the midi clock, i can’t figure out how to calculate the right moment based on the ppq/samplerate/bpm information. I guess the midi tick resolution is much smaller then the DAW resolution so timing should not be an issue. But how to do this all information i have is this http://atom.maczo.pl/~atom/stuff/tech/midispec.htm but i don’t really know how to implement this.

If someone could share a piece of psuedo code with me that calcluates those midi ticks, that would help a lot.


#2

Yes, I should have explained that better… I think (it’s been a while since I wrote it!) that 1 bar = 960 ppq, and that’s the standard.

It’ll be quite tricky to send the midi events at exactly the right time, because the audio callbacks may jitter slightly - you’ll need to use extreme cunning to smooth them out!


#3

i know at least one DAW that has variable PPQ (set per project)

also would it be possible to catch this flag in AudioProcessor, as set in the VST SDK, i don’t know about the rest of the formats i don’t use them.

VstInt32 	samplesToNextClock
MIDI Clock Resolution (24 Per Quarter Note), can be negative (nearest clock). 

if not, is it possible to access the VST namespace myslef inside the wrapper, if so what would be the right way to do this?


#4

Sorry, I just meant that it was the standard way that the audioprocessor class would provide the value. If hosts are giving different values then I’d have to fix the VST wrapper to deal with that - but just because they let you change the ppq in their UI doesn’t mean it’ll also be passed down in that form.

I’ve no time to think about adding anything to the vst info stuff at the moment, sorry - it’d have to wait until I next do some plugin work.