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

Fix quantization in the effect engine (metronome effect) #13636

Merged
merged 19 commits into from
Sep 15, 2024

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented Sep 8, 2024

This was originally a fix for #13611 but it turns out that the beat information provided into the effect engine itself was broken. I have fixed this at the root by refactoring GroupFeatureState and the "beat_next" and "beat_prev" COs.
Than I was able to finally fix the metronome, which works now also reliable during scratching.

Not sure if there is a real use case for it, but the metronome was perfectly to test that, and also helps verifying a beat grid by ear. It would be a real fun to play any sample and not only the metronome click. That could become our first "transport" effect. I will file a feature request.

Open is to check/fix other effects. I want to have that reviewed and merged first before building on that.
See commits for details.

@daschuer daschuer added this to the 2.4.2 milestone Sep 8, 2024
src/effects/backends/builtin/metronomeeffect.cpp Outdated Show resolved Hide resolved
src/engine/effects/groupfeaturestate.h Outdated Show resolved Hide resolved
src/effects/backends/builtin/metronomeeffect.cpp Outdated Show resolved Hide resolved
src/effects/backends/builtin/metronomeeffect.cpp Outdated Show resolved Hide resolved
src/effects/backends/builtin/loudnesscontoureffect.cpp Outdated Show resolved Hide resolved
@daschuer
Copy link
Member Author

daschuer commented Sep 9, 2024

Done.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the changes here are really hard to follow because they mix offset and timing calculations with buffer indexing (mixing levels of abstraction) and thus I'm neither confident about the reliability nor safety of the code...

Do you think its feasible to reorganize it a little so its easier to understand?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried to fix that by calculate everything in frames. Maybe I was not too successful or comments are missing.
Can you give some hints what can be improved?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rework it a little and open a PR to your branch ASAP.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look daschuer#97

@daschuer
Copy link
Member Author

I have added the first commit of your branch from daschuer#97
Can we merge this first, before doing the std::span refactoring?
I am not convinced that this reduces complexity, because it brings back the sample count where I am very happy to with the frame based counters.

@Swiftb0y
Copy link
Member

Swiftb0y commented Sep 12, 2024

Can we merge this first, before doing the std::span refactoring?

Sure, but unfortunately I encountered a couple bugs during testing:

  1. Sync on the Metronome is off: expected: it should continue clicking based on the fixed rate of the knob. Currently Observed: it only does not click at all, only when enabling the effect, and with its transient chopped of.
  2. Sync on the Metronome is on but track has no beatgrid. Expected: in 2.4 it currently just ignores the sync and clicks based on the fixed rate, though maybe it should just stay silent? Observed: it just clicks once when enabling, though this time its the full sample.

Both of these issues are regressions.

@daschuer
Copy link
Member Author

The described issues are fixed now. It was caused by a faulty fix to avoid SINT overflow.

@Swiftb0y
Copy link
Member

I don't understand the fix... There also remains the issue where the first click is with sync disabled is muffled.

@daschuer
Copy link
Member Author

There also remains the issue where the first click is with sync disabled is muffled.

This is a "feature", the fade in of the effect. But we can safely disable this here.

I have removed a redundant check and added comments to the last summit.

@daschuer
Copy link
Member Author

Done, please have a look.

@Swiftb0y
Copy link
Member

fyi, I got daschuer#97 into a state I'm happy with. Please take a look.

@daschuer
Copy link
Member Author

I have adopted the full span based approach. But I have not adopted the rest, because of the std::size_t / std::ptrdiff_t / SINT clash with gsl/span. I also must admit that I can not fully understand how your code works.

@Swiftb0y
Copy link
Member

I think the primary advantage of my span approach was not the fact that it uses span (it just made it easier for myself to do the cleanup I wanted to do). The real improvement was separating the messy sync code from the rest. But I'm okay with the current state as a temporary stopgap.

Copy link
Member

@Swiftb0y Swiftb0y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM for now. I will retarget the follow up at main.

@Swiftb0y Swiftb0y merged commit e72f7d1 into mixxxdj:2.4 Sep 15, 2024
14 checks passed
@ronso0 ronso0 changed the title Fix quantization in the effect engine (mentronome effect) Fix quantization in the effect engine (metronome effect) Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants