DISTRHO Plugin Framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
falkTX 14423c5eec
Automable is not a word, sorry!
3 years ago
..
DistrhoPluginInfo.h Add Metronome example 4 years ago
ExamplePluginMetronome.cpp Automable is not a word, sorry! 3 years ago
Makefile VST3: implement time position; enable metronome vst3 build 3 years ago
README.md Small fixing to metronome example, works again 4 years ago

README.md

Metronome example

This example will show tempo sync in DPF.

This plugin will output a sine wave at the start of every beat.
The pitch of sine wave is 1 octave higher at the start of every bar.

4 parameters are avaialble:

  • Gain
  • Decay time
  • Semitone
  • Cent

To calculate frames to the next beat from the start of current audio buffer, following implementation is used.

const TimePosition& timePos(getTimePosition());

if (timePos.bbt.valid)
{
    double secondsPerBeat = 60.0 / timePos.bbt.beatsPerMinute;
    double framesPerBeat  = sampleRate * secondsPerBeat;
    double beatFraction   = timePos.bbt.tick / timePos.bbt.ticksPerBeat;

    uint32_t framesToNextBeat = d_isZero(beatFraction)
                              ? 0
                              : static_cast<uint32_t>(framesPerBeat * (1.0 - beatFraction));
    // ...
}

Reference: