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

Real-time-capable limiter #6305

Closed
saintmatthieu opened this issue Apr 18, 2024 · 13 comments · Fixed by #6395
Closed

Real-time-capable limiter #6305

saintmatthieu opened this issue Apr 18, 2024 · 13 comments · Fixed by #6395
Assignees
Labels
Enhancement Request Or feature requests. Open-ended requests are better suited for discussions.
Milestone

Comments

@saintmatthieu
Copy link
Contributor

Your idea

A limiter is an essential component in a mastering chain to reduce severeness of clipping.
Add a limiter to Audacity's built-in real-time effects. If appropriate, design it so that it can also be used as compressor.
Stretch goal: make it configurable for extra smoothness and classical music, in a Chris's compressor style.

Problem to be solved

Also, Audacity lacks real-time limiter and compressor, although these are essential to mastering.
Stretch goal would also resolve #2397.

Prior art

No response

Additional context

No response

@saintmatthieu saintmatthieu added the Enhancement Request Or feature requests. Open-ended requests are better suited for discussions. label Apr 18, 2024
@saintmatthieu saintmatthieu added this to the Audacity 3.6 milestone Apr 18, 2024
@saintmatthieu saintmatthieu self-assigned this Apr 18, 2024
@forart
Copy link

forart commented Apr 23, 2024

....what about "porting" existing opensource ones ?

Some examples:

EDIT:
@saintmatthieu I've collected some interesting open source Mastering tools for my HyMPS project: enjoy.

Hope that inspires.

@nhthn
Copy link

nhthn commented Apr 23, 2024

Flattered, but I don't recommend my SafetyLimiter -- I've found cases where it sounds bad. Designing a good brickwall limiter is pretty challenging, it turns out.

@saintmatthieu
Copy link
Contributor Author

Great resource, @forart, thank you very much! I haven't looked at all the referred repos in depth, but it looks indeed like a gold mine of inspiration.
FYI I'm integrating Daniel Rudrich's SimpleCompressor, at least as starting point. (I haven't seen this repo mentioned in your HyMPS project?) Besides readily being in C++, it is predictable, has all controls primarily needed, and is well documented.

@forart
Copy link

forart commented Apr 24, 2024

Great resource, @forart, thank you very much! I haven't looked at all the referred repos in depth, but it looks indeed like a gold mine of inspiration.

Well, that's why the HyMPS project exists: stimulate collaborations/knowledge-exchange between open source developers to favor their projects/softwares mutual evolution.

FYI I'm integrating Daniel Rudrich's SimpleCompressor, at least as starting point.

AAYSR (ask and you shall receive): just added this interesting @DanielRudrich's resource to brand new AUDIO \ Effects \ General subsection !
(note: given that it seems to perform dual functionality - compressor & limiter - do you think it would be better to move it under Multi?)

EDIT:
Since @intel's OpenVINO™ AI Plugins for Audacity has been released, it could be interesting to involve @RyanMetcalfeInt8 in AI Compressor by @jamesnapierstuart port.
Check out this discussion.

(I haven't seen this repo mentioned in your HyMPS project?) Besides readily being in C++, it is predictable, has all controls primarily needed, and is well documented.

Well, although it's starting to get pretty meaty, consider that actually I'm (manually) maintaining/expanding/revising the whole HyMPS project alone: of course (constructive) contributions are always welcomed !

Happy coding !

@saintmatthieu
Copy link
Contributor Author

(note: given that it seems to perform dual functionality - compressor & limiter - do you think it would be better to move it under Multi?)

It's definitely not just a limiter. Either under "multi" or "compressing".

@DanielRudrich
Copy link

How about Dynamics? Thanks for adding it to your list!

@Jesse-Hufstetler
Copy link

I ported starfish limiter to C++ a while ago, the code is lying around somewhere if anybody wants it

@bastibe
Copy link

bastibe commented Apr 25, 2024

I can't recommend my Simple Cython Limiter, either. It was written more of a demonstration of Cython than a good limiter.

@pzelasko
Copy link

My cylimiter is based on @bastibe implementation, just rewritten to C++, a bit more optimized, wrapped to Python and PyPI packaged. It works well for machine learning applications and managing gain for speech ML model inputs and outputs but it hasn’t been evaluated for quality on music.

@x42
Copy link

x42 commented Apr 25, 2024

The code use in https://github.com/x42/sound-gambit is a somewhat cleaner version of what is used https://x42-plugins.com/x42/x42-limiter as well as Ardour's LUFS normalization during export (https://github.com/Ardour/ardour/blob/master/libs/audiographer/private/limiter/limiter.cc). It is based on Fons Adriansens DPL-1 with the addition of true-peak support.

It is close to audibly transparent, works very well for music and does not allow a single sample above the threshold.
It also maximize the signal with respect to phase rotation, and best of all it's realtime safe and doesn't take a lot of DSP.
It's mostly C with a few sensible features of C++ and just a single source file and a header.

You don't have to take my word for it. Since audacity supports LV2 plugins you can already use it today and evaluate it.
Cross platform binaries are available from https://x42-plugins.com/x42/x42-limiter

@saintmatthieu
Copy link
Contributor Author

Interesting, I wasn't planning on adding a true-peak feature, but this makes it tempting.
By "maximizing the signal wrt phase rotation" do you mean something other than the true-peak feature ?

@x42
Copy link

x42 commented Apr 28, 2024

It is unrelated to true-peak detection.

Details on phase roration I should not have mentioned it since it's a feature common to pro audio limiters. e.g. u-he's presswerk has an option for this.

Phase rotation is about altering the waveform shape but not the perceived sound [1]. It originated in FM broadcast to help make asymmetrical waveforms more symmetrical, which allows more gain before clipping. These days phase rotation circuits are used during mastering to increase headroom.

In case of x42-limiter it is a side-effect of how the DSP works. Rotating the phase of the resulting signal will always only increase the signal level.

--

[1] specifically it is a phase shift, where different components of the signal are delayed differently depending on their frequency.
The interesting aspect is that phase rotation does not alter the sound of the signal nor the loudness. However changing the phase vs. frequency relationship between lower and upper harmonics changes the waveform and can affect where the [digital] peak occurs.

@dozzzzer
Copy link
Contributor

Tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Request Or feature requests. Open-ended requests are better suited for discussions.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

9 participants