Closed harmomyshoes closed 2 months ago
The Limiter class does indeed introduce a little bit of delay, as stated in the documentation. The delay is currently set to 60% of the attack time, and is manifested as a snippet of digital silence in the beginning. If I remember correctly, the delay is "needed" for the current implementation in cylimiter to work as intended. I agree it's not ideal. Would you like to work on an improved implementation that does not introduce the delay?
@pzelasko Do you remember why the delay is needed?
IIRC delay acts as a lookahead for the limiter and lets it anticipate sudden peaks in the future. Since this is a streaming limiter it can’t consider the whole signal ahead of time. You can simply right-pad the input by delay and truncate first delay samples from the output if you don’t care about streaming.
Many thanks for replying. I will go for some solution for my purpose at the momemnt, if it is also applied for this limiter, I will update here!
I think we can use pzelasko's idea of padding the input before passing it to the limiter, which would result in an aligned output without the region of digital silence. An ideal solution for audiomentations would be to use an "offline" limiter without delay (but still with lookahead) instead of a streaming limiter.
I am not sure whether it is the case. just find when applied the limiter undernearth on the sine wave, it will adding some blank in the audio file. I rekon it is due to the "delay" parameter. I have tested the Climiter, it is working fine with the delay equal to 0 condition.
I don't know if this will cause some problem in some situation. The grey line is the test tone after applied the limiter.
def AlterDyn(self, thres_db, data): if(thres_db != 0): Audio_Transform = Limiter(min_threshold_db=-thres_db,max_threshold_db=-thres_db,threshold_mode="relative_to_signal_peak",p=1.0) data = Audio_Transform(data, sample_rate=self.samplerate) return data
def SinWaveGenerator(self): t = np.linspace(0, self.duration, int(self.duration * self.samplerate), endpoint=False) sine = np.sin(2 * np.pi * self.frequency * t) return sine ...