AuburnSounds / AuburnSounds/Dplug

Add musical time to TimeInfo, support tempo change

Open
#685 3 comments 0 reactions 0 assignees View on GitHub
Enhancement
Dominant language
D
Stars
564
Forks
34
PR merge metrics
No merged PRs in 30d

Description

It would be good to have a parameter on `TimeInfo` which gives access to the DAW's elapsed musical time. I'm thinking something like JUCE's `AudioPlayHead::PositionInfo.getPpqPosition()`.

At the moment it is possible (albeit rather fiddly) to reconstruct the musical position from the current sample rate, `TimeInfo.tempo` and `TimeInfo.timeInSamples`, however there are a couple of problems with this approach:

1. If there is any tempo automation *before* the current playhead position, there is no way to figure out the current musical position as the tempo change will have scrambled the relationship between samples & beats/bars. You can still calculate musical time relative to when the user hit play, but not the absolute song position of the playhead.
2. On Reaper at least, there is vari-speed control for the whole project which does some weird thing where it misreports the sample rate to make everything run slower/faster. This is a great feature but it breaks my plugin & a couple of others I've used. Having a musical time parameter would fix this.
3. It makes the logic for any kind of sequencer much cleaner, particularly if the sequencer is expected to follow tempo.

I believe this is a cross-platform feature as the JUCE docs don't mention any caveats about what hosts it works in. I'd be willing to take a look at raising a PR if you don't have time for this, but I'm quite a n00b with D 😅

BTW absolutely loving Dplug so far, thank you for giving the people a better way of writing plugins!

Contributor guide

Open the contributing guide

Research direction

Start by reading the TimeInfo API and comparing the requested value with JUCE's AudioPlayHead::PositionInfo.getPpqPosition(). Determine how absolute musical position and tempo changes should be represented across supported hosts, including Reaper's vari-speed behavior. Done means TimeInfo exposes reliable musical time without reconstructing it from samples.

Written by the indexing model from the issue text.

Assessment

Domain
audio-video-rtc
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.