Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discontinuities in sample-exact automation in high tempo, resulting in crackles #6567

Open
PhysSong opened this issue Nov 16, 2022 · 1 comment

Comments

@PhysSong
Copy link
Member

(Originally reported by @LostRobotMusic on Discord)

Bug Summary

  • Sample-exact automation doesn't work well if a tick is shorter than the buffer size. Some jump discontinuities are observed in the automation.
    Note this bug depends on your sample rate and buffer size settings. If you can't reproduce the bug, try higher tempo, larger buffer size and lower sample rate.

Steps to reproduce

  • Set tempo to sufficiently high value(300 is enough for sample rate 44100Hz and buffer size 256)
  • Add any instrument, and add amplifier effect in the track
  • Connect the gain of the amplifier to an automation pattern with linear progression
  • Render to a file

Here's an example project file:
bug.mmp.zip

Expected behavior

Smooth automation

Actual behavior

Discontinuity observed, resulting in audible crackles

Affected LMMS versions

Not sure

@PhysSong PhysSong added the bug label Nov 16, 2022
@PhysSong PhysSong added the core label Jan 7, 2023
@PhysSong
Copy link
Member Author

PhysSong commented Jan 7, 2023

In AutomatableModel::valueBuffer, this part handles sample-exact automation:

if( m_oldValue != val )
{
m_valueBuffer.interpolate( m_oldValue, val );

In Song::processNextBuffer, automation is handled at the beginning of every tick:

lmms/src/core/Song.cpp

Lines 338 to 341 in 679d632

if (static_cast<f_cnt_t>(frameOffsetInTick) == 0)
{
// First frame of tick: process automation and play tracks
processAutomations(trackList, getPlayPos(), framesToPlay);

If two or more beginning of ticks present in a rendering buffer, the interpolation logic doesn't work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant