Giter VIP home page Giter VIP logo

lamb-rs's Introduction

lamb 🐑

A lookahead compressor/limiter that's soft as a lamb.

screenshot

Lamb was made with these goals in mind:

  • Sound as clean as possible and as dirty as desired.
  • Give the user full control over the character with the minimum amount of knobs.

Features

The following features set it apart from other compressor/limiters:

Use it as a brickwall limiter, a compressor, a leveler, a waveshaper/clipper or anything in between.

As long as the ratio is inf:1, the lookahead is 100% and the output gain is 0dB, the output will not exceed the threshold1.
When the attack, release, release hold and adaptive release are all at their minimum value, you get a waveshaper/clipper.
When adaptive release is at 100%, you get a leveler.

Adjust the shape of the attack and release.

The inspiration for this came from a video by Dan Worrall.
When shape is at 0, the curve is a slice of pure sine.
lamb_shape

No discontinuities in the derivative of the gain reduction.

The gain never abruptly changes direction, resulting in a smoother sound, even at short attack and release times.

Release hold eliminates distortion while keeping most of the level.

Release hold prevents the gain from coming up if it needs to go back down again soon.
You control how soon is soon.
Here's a gain reduction graph with and without it: hold

Adaptive release (optionally) prevents pumping.

With adaptive release, the gain won't rush up too much when there is a quiet part after a big peak, but it will still react quickly to transients.
The first couple of dB of release have the speed you set with the release knob, after that it slows down.
The adaptive release slider controls how many dBs will release fast and how much it will slow down afterwards.
If you DO want obvious pumping, just turn adaptive release off!

Exact attack and release times allow you to easily match any breathing to the tempo of your track.

In most compressors and limiters, the times describe how long it takes to do "most" of the gain change.
In lamb, 500 ms corresponds to exactly 1/4 note at 120 BPM.

Adjust the amount of stereo linkage.

Most limiters are fully stereo linked. This makes sense, since you don't want the stereo image to shift.
However, if the asymmetry in gain reduction is small and short enough, you won't notice any shift in stereo image.
(Partially) unlinking left and right can sometimes sound more natural, because a loud sound on one side won't make the other side duck in level.
Slower changes in gain reduction, caused by adaptive release, are always fully linked.
You can set the amount of linkage for transients as needed.

Choose between fixed or minimum latency.

In most case, you can leave this at fixed, but if you want to use lamb live or for tracking, you can set it to minimum.
The latency is always reported to the host.

Downsides

There are two main downsides to this plugin:

  • Heavy on the CPU.
    Because of the advanced algorithm, this plugin is quite heavy.
    I have done everything in my power to make it lighter, from writing a highly optimized sliding minimum algorithm
    to writing an N dimensional memoization function.
    If you are good at math or computer science and want to help me optimize it more, open an issue, or better yet a PR!
  • Long latency.
    The clean sound of this plugin is partially made possible by copious amount of lookahead.
    In fixed latency mode, the latency is 100ms.
    In minimum latency mode, the latency depends on the attack, release hold and lookahead parameters.

Usage

Apart from regular dragging and using the mouse-wheel, you can interact with the sliders in the following ways:

  • Shift + drag or mouse-wheel: fine adjustments
  • Alt + click on a slider: type a value
  • Double-click or right-click on a slider: back to the default value.

Building and installing

After installing Rust, you can build and install lamb as follows:

git submodule update --init --recursive
cargo xtask bundle lamb --release
cp -r target/bundled/lamb.vst3 ~/.vst3

User preferences

ATTENTION If you want to use the plugin with a samplerate of more than 48k, make sure you change MaxSampleRate at the start of lamb.dsp.
There's a couple of other user preferences as well, documented in the dsp file.

Rebuilding the Faust dsp

NOTE: this is only needed if you want to change the dsp, not if you just want to compile the plugin.

The faust dsp code in dsp/lamb.dsp is only transpiled to rust if you build with the faust-rebuild feature activated, like so:

cargo xtask bundle lamb --release  --features faust-rebuild

The smoothing algorithm in lamb needs double precision to work.
This only recently got supported, so you need to use faust version 2.72.14 or newer.
This faust version has a bug for Windows, that got fixed here.
Therefore, Windows users currently need to build faust from source to be able to rebuild the dsp of lamb.
Here's a quick tutorial on how to do that.

Thanks

This plugin would not have been possible without the following projects:

I would like to thank Stéphane Letz, Robbert van der Helm, obsoleszenz, luna, Dr George Atkinson and Dario Sanfilippo for their fantastic support and feedback!

🐑

Footnotes

  1. Lamb does not feature True Peak limiting yet. This is in the pipeline though: https://github.com/magnetophon/lamb-rs/milestone/1
    For most applications, this is less of an issue then you might think, see: https://www.izotope.com/en/learn/true-peak-limiter.html

lamb-rs's People

Contributors

223230 avatar magnetophon avatar obsoleszenz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lamb-rs's Issues

Segfault with VST3 Release build on Linux

Ran it in carla-single, after a bit of toying with parameters.

Built using the instructions in the Readme on Debian 12/bookworm

13:04:53 [ERROR] thread 'unnamed' panicked at 'assertion `left == right` failed
  left: -1
 right: 1': /home/dreamer/.cargo/git/checkouts/nih-plug-a2d2dc277b128e13/bb27497/src/wrapper/vst3/view.rs:482
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: start_thread
             at ./nptl/pthread_create.c:442:8
  14: __GI___clone3
             at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

[carla] Carla exception caught: "idle()" in file ../backend/engine/CarlaEngineRunner.cpp, line 108
fatal runtime error: Rust panics must be rethrown
Aborted

Submodule should use https instead of ssh

I am not able to recursively clone this repository because the dsp submodule uses ssh instead of https.

This can be fixed by changing the line url = [email protected]:magnetophon/lamb.git in .gitmodules to url = https://github.com/magnetophon/lamb.git.

Seg fault when opening debug standalone

built with cargo xtask bundle lamb --debug
ran with cargo run

Here's what lldb says about it.

Process 42942 launched: '/Users/brady/Documents/GitHub/lamb-rs/target/debug/lamb' (arm64)
11:04:29 [INFO] jack_sys: Loading jack from libjack.0.dylib.
11:04:29 [INFO] nih_plug::wrapper::standalone::backend::cpal: Audio inputs are not connected automatically to prevent feedback. Use the '--input-device' option to choose an input device.
2024-04-02 11:04:30.139357-0700 lamb[42942:737453] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x12c904fd0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2024-04-02 11:04:30.146370-0700 lamb[42942:737453]      HALC_ShellDevice.cpp:2609   HALC_ShellDevice::RebuildControlList: couldn't find the control object
11:04:30 [INFO] nih_plug::wrapper::standalone: Using the CoreAudio backend
Process 42942 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x16f525bf0)
    frame #0: 0x000000010013cac0 lamb`_$LT$lamb..Lamb$u20$as$u20$core..default..Default$GT$::default::h494893d9fe27395a at lib.rs:38
   35       gain_reduction_right: Arc<AtomicF32>,
   36   }
   37   impl Default for Lamb {
-> 38       fn default() -> Self {
   39           Self {
   40               params: Arc::new(LambParams::default()),
   41  
Target 0: (lamb) stopped.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.