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

Limiter Plugin seems also to normalize? #282

Open
Franky1 opened this issue Dec 12, 2023 · 1 comment
Open

Limiter Plugin seems also to normalize? #282

Franky1 opened this issue Dec 12, 2023 · 1 comment

Comments

@Franky1
Copy link

Franky1 commented Dec 12, 2023

The internal plugin Limiter seems also to normalize the output.
If i put in the Limiter in a board and examine the output, it is always scaled to [-1.0; +1.0] after the Limiter.
I would not expect this behaviour, is it intended?
Example code to reproduce:

pedalboard = Pedalboard(
    [
        Limiter(),
    ],
)

# Open input file:
with ReadableAudioFile(filename="input.wav") as f:
    # Open an audio file to write to:
    with WriteableAudioFile(filename="output.wav", samplerate=f.samplerate, num_channels=f.num_channels, bit_depth=16) as outfile:
        # Read all the frames from the file:
        chunk = f.read(f.frames).flatten()
        print(f"type chunk: {type(chunk)}")
        print(f"size chunk: {chunk.shape}")
        print(f"max chunk: {chunk.max()}")
        print(f"min chunk: {chunk.min()}")
        # Run the audio through our pedalboard:
        effected = pedalboard(chunk, f.samplerate, reset=False)
        print(f"type effected: {type(effected)}")
        print(f"size effected: {effected.shape}")
        print(f"max effected: {effected.max()}")
        print(f"min effected: {effected.min()}")
        # Write the output to our output file:
        outfile.write(effected)

For example i get this output:

type chunk: <class 'numpy.ndarray'>
size chunk: (109656,)
max chunk: 0.6926786303520203
min chunk: -0.5552842617034912
type effected: <class 'numpy.ndarray'>
size effected: (109656,)
max effected: 1.0
min effected: -1.0
@lff5
Copy link

lff5 commented Jan 23, 2024

First, pedalboard is really awesome open source lib, Thanks!

I too discovered that the Limiter() is not just limiting after finding out that the output files look like maxed out bricks.
I hoped to pass the audio through Limiter() to ensure there is no hard clipping.

The documentation is a bit lacking, just mentioning that there are two compressors inside and one can set threshold_db. Without knowing compressor ratio etc its hard to tell what the threshold_db exactly does.

Could you add an optional argument to bypass the internal compression part to have just pure Limiter?

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

No branches or pull requests

2 participants