Replies: 11 comments
-
DPF follows the JACK transport API when it comes to tempo.
Ticks are unrelated to frames. |
Beta Was this translation helpful? Give feedback.
-
So auto ticksPerSecond = bbt.ticksPerBeat * bbt.beatsPerMinute / 60;
auto secondsPerTick = 1.0 / ticksPerSecond; Thank you for the explanation. |
Beta Was this translation helpful? Give feedback.
-
It is best not to do things based on tick count though. I guess I can make it a double.. JACK standalones do not have this fine precision, but LV2 and VST2 plugins do. |
Beta Was this translation helpful? Give feedback.
-
Hi. I have another question. I'm trying to make a CV plugin which outputs trigger signal at the start of bar/beat. I wrote a code like following: void run(const float **, float **outputs, uint32_t frames) override
{
const auto timePos = getTimePosition();
if (timePos.bbt.valid) {
auto &bbt = timePos.bbt;
double secondsPerTick = 60.0 / (bbt.ticksPerBeat * bbt.beatsPerMinute);
double tickLength = sampleRate * secondsPerTick;
double beatLength = tickLength * bbt.ticksPerBeat;
double barLength = beatLength * bbt.beatsPerBar;
double barStartFrame = tickLength * bbt.barStartTick;
double beatStartFrame = barStartFrame + beatLength * (bbt.beat - 1);
double tickStartFrame = beatStartFrame + tickLength * bbt.tick;
double offsetToNextTick = timePos.frame - tickStartFrame;
// ...
}
} I'm trying to calculate frame offset from the start of current buffer to the next tick as The question is that where exactly is Following is a drawing of my understanding of relation about tick and the start of buffer. Start of buffer is more close to B. I'd like to know which of tick A or tick B becomes |
Beta Was this translation helpful? Give feedback.
-
the transport information refers to the frame 0 of each process cycle. so yes, closest to the start of each buffer |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer. I tested more and found that the code on previous comment breaks when tempo is changed. I looked up LV2 metronome example, and it seems like they are using barBeat which is provided by float. Is it possible to add barBeat to |
Beta Was this translation helpful? Give feedback.
-
hey, sorry for the lack of news on this. |
Beta Was this translation helpful? Give feedback.
-
I'd like to say thanks for your works. DPF and Carla made my plugin development far easier. Just one thing, I know a person who got mentally ill for working too hard, so please take your time and get a break when feeling tired. It's OK to procrastinate. For anyone stumbled upon this issue, I have temporary patches to solve this issue on here ( |
Beta Was this translation helpful? Give feedback.
-
In hvcc I'm doing this: https://github.com/Wasted-Audio/hvcc/blob/develop/hvcc/generators/c2dpf/templates/HeavyDPF.cpp#L192 Here we generate MTC clock signals, which is 24 ticks per beat, that are scheduled into the hvcc processing buffer. Any remaining frames are taken over to the next processing cycle cycle and handled there. This way the window of midi ticks vs processing frames moves along. I use a double to count samples, should that be enough? CardinalPlugin does something similar here, right? -> https://github.com/DISTRHO/Cardinal/blob/main/src/CardinalPlugin.cpp#L926 It would be nice to know some best-practice around this stuff in DPF. |
Beta Was this translation helpful? Give feedback.
-
MTC in plugins doesnt make sense though. The midi time code in cardinal only for start/stop/continue triggers. |
Beta Was this translation helpful? Give feedback.
-
In hvcc it's all puredata logic to do stuff. so having a sample accurate MTC is nice there. You have no other way to sync to anything otherwise. So yeah it's just midi paradigm you generally have to work with. |
Beta Was this translation helpful? Give feedback.
-
I looked up
TimePosition
andBarBeatTick
, but they don't seem to have informations to map MIDI time to frame count.I'd like to get following informations:
Or is it expected to handle MIDI time code directly?
It also looks like
VstTimeInfo
investige.h
has all relevant information.Beta Was this translation helpful? Give feedback.
All reactions