spotify / pedalboard

🎛 🔊 A Python library for audio.
https://spotify.github.io/pedalboard
GNU General Public License v3.0
5.23k stars 262 forks source link

parameter changes unaffecting `pedalboard.VST3Plugin.process` call immediately after #137

Closed stet-stet closed 2 years ago

stet-stet commented 2 years ago

I am on Windows. pedalboard.__version__ gives 0.5.8. I am running this on Jupyter Notebook, ipykernel.__version__ is 5.5.5, if it helps.

The bug is as my title explains: parameter changes do not affect the Process call coming immediately after.

To reproduce this bug, please first download kiloHearts Reverb here (it's free). (I'm not sure if this bug exists with other plugins.)

import pedalboard
import pprint 
path_to = r"C:\Program Files\Common Files\VST3\Kilohearts\kHs Reverb.vst3"
Plugin = pedalboard.load_plugin(path_to)
Plugin.name
param_names = list(Plugin.parameters)
print(len(Plugin.parameters))
pprint.pprint(Plugin.parameters)

this gives:

8
{'bypass': <pedalboard.AudioProcessorParameter name="Bypass" discrete raw_value=0 value="Off" (1 valid string value)>,
 'dampen': <pedalboard.AudioProcessorParameter name="Dampen" discrete raw_value=0.250333 value="25.0 dB/s" (1001 valid string values)>,
 'decay': <pedalboard.AudioProcessorParameter name="Decay" discrete raw_value=0.437618 value="3.00 s" (854 valid string values)>,
 'early': <pedalboard.AudioProcessorParameter name="Early" discrete raw_value=0.248333 value=25 % range=(0.0, 100.0, 1.0)>,
 'midi': <pedalboard.AudioProcessorParameter name="MIDI" discrete raw_value=0 value="" (1 valid string value)>,
 'mix': <pedalboard.AudioProcessorParameter name="Mix" discrete raw_value=0.25 value=25 % range=(0.0, 100.0, 1.0)>,
 'size': <pedalboard.AudioProcessorParameter name="Size" discrete raw_value=0.5 value=100 % range=(50.0, 200.0, 1.0)>,
 'width': <pedalboard.AudioProcessorParameter name="Width" discrete raw_value=0.5 value=100 % range=(0.0, 200.0, 1.0)>}

Yeah: nothing wrong here. Now for the real problem. Consider the code cell below:

import matplotlib.pyplot as plt
import time 
import soundfile as sf
import numpy as np
Plugin.reset()
for name in ["dampen","decay","early","mix","size","width"]:
    setattr(Plugin,name,Plugin.parameters[name].valid_values[-1])
Plugin.early = Plugin.parameters["early"].valid_values[-1]

impulse, sr = sf.read("impulse24.wav")
zero = [0 for _ in range(len(impulse))]
impulse_R = np.stack([zero,impulse]).T
impulse_L = np.stack([impulse,zero]).T
left_ir = Plugin.process(impulse_L,sr,reset=True)
right_ir = Plugin.process(impulse_R,sr,reset=True)

plt.subplot(2,1,1)
plt.plot(left_ir)
plt.xlim(0,20000)
plt.ylim(-1,1)
plt.subplot(2,1,2)
plt.plot(right_ir)
plt.xlim(0,20000)
plt.ylim(-1,1)

now, we run this twice. For best visibility, I chose to use a 24-bit mono near-unit impulse signal as impulse24.wav.

The first time you run the above cell, this is what you get: image The second time you run the above cell, this is what you get: image

I expected the two outputs to be the same, but this does not seem to be the case! Therefore I would like some help. Thank you!

stet-stet commented 2 years ago

Whoops, issue isn't reproducible with plugins like Fabfilter Pro-R or Softube TSAR-1R. I'll just close this. Sorry for posting without confirming first!