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 doesn't work. #369

Open
MMMMichaelzhang opened this issue Aug 21, 2024 · 0 comments
Open

Limiter doesn't work. #369

MMMMichaelzhang opened this issue Aug 21, 2024 · 0 comments

Comments

@MMMMichaelzhang
Copy link

MMMMichaelzhang commented Aug 21, 2024

Here is my code, when I add Reverb or any other effector, it works fine, but when I add limiter, no matter what value I set my thresthold_db to, the sound is very low, almost inaudible.

from pedalboard import Pedalboard
from pedalboard_native import Limiter, Gain
import pyaudio
import wave
import time
import numpy as np

board = Pedalboard([
    Limiter(threshold_db=-0.1)
])

path = "/Users/michael/Desktop/test1111.wav"
wf = wave.open(path, "rb")
wav_data = wf.readframes(wf.getnframes())
meta = {"seek": 0}

def callback(in_data, frame_count, time_info, status):
    start = meta["seek"]
    meta["seek"] += frame_count * pyaudio.get_sample_size(pyaudio.paInt16) * wf.getnchannels()
    data = wav_data[start: meta["seek"]]
    data = np.frombuffer(data, dtype=np.int16).astype(np.float32)
    data = board(data, 44100, reset=False)
    data = data.astype(np.int16)
    data = data.tobytes()
    return (data, pyaudio.paContinue)

audio = pyaudio.PyAudio()
stream = audio.open(format=audio.get_format_from_width(wf.getsampwidth()),
                channels=wf.getnchannels(),
                rate=wf.getframerate(),
                output=True,
                stream_callback=callback)

stream.start_stream()

while stream.is_active():
    time.sleep(0.1)
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

1 participant