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

Can't set any parameters for TAL-BassLine-101 #191

Open
turian opened this issue Dec 6, 2023 · 1 comment
Open

Can't set any parameters for TAL-BassLine-101 #191

turian opened this issue Dec 6, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@turian
Copy link

turian commented Dec 6, 2023

I am not able to get any sound from TAL-BassLine-101 if I try to set any parameters of the plugin.

To start, I demonstrate the plugin works fine from pedalboard:

from pedalboard import Pedalboard, load_plugin
from mido import Message # not part of Pedalboard, but convenient!
import torchaudio
import torch
import dawdreamer as daw

# Load a VST3 or Audio Unit plugin from a known path on disk:
instrument = load_plugin("/Library/Audio/Plug-Ins/VST3/TAL-BassLine-101.vst3")
instrument.load_preset("presets-TAL_BassLine_101/Solidtrax/Piano/ST_Electric_Piano_01.vstpreset")

# Render some audio by passing MIDI to an instrument:
sample_rate = 44100
audio = instrument(
  [Message("note_on", note=60), Message("note_off", note=60, time=1)],
  duration=2, # seconds
  sample_rate=sample_rate,
)

torchaudio.save("pb1.wav", torch.tensor(audio * 32767, dtype=torch.int16), sample_rate)

which gives us
pb1.webm

Now, let's load the plug-in using DawDreamer:

engine = daw.RenderEngine(sample_rate, 512)
engine.set_bpm(120.)

synth = engine.make_plugin_processor("synth", "/Library/Audio/Plug-Ins/VST3/TAL-BassLine-101.vst3")

# (MIDI note, velocity, start sec, duration sec)
synth.add_midi_note(60, 127, 0.0, 1)

engine.load_graph([
  (synth, []),
  ])

engine.render(2.)  # render 4 seconds.
audio = engine.get_audio()

torchaudio.save("dd10.wav", torch.tensor(audio * 32767, dtype=torch.int16), sample_rate)

An error message is thrown:

error: attempt to map invalid URI `/Library/Audio/Plug-Ins/VST3/TAL-BassLine-101.vst3'

but inspecting synth.get_parameters_description() suggests that the plug-in did load anyway (?!) and we do save audio:
dd10.webm

However, if I trying setting the parameters to values between 0 and 1:

engine = daw.RenderEngine(sample_rate, 512)
engine.set_bpm(120.)

synth = engine.make_plugin_processor("synth", "/Library/Audio/Plug-Ins/VST3/TAL-BassLine-101.vst3")
for i, p in enumerate(instrument.parameters.keys()):
    synth.set_parameter(i, instrument.__getattr__(p).raw_value)

# (MIDI note, velocity, start sec, duration sec)
synth.add_midi_note(60, 127, 0.0, 1)

engine.load_graph([
  (synth, []),
  ])

engine.render(2.)  # render 4 seconds.
audio = engine.get_audio()

torchaudio.save("dd11.wav", torch.tensor(audio * 32767, dtype=torch.int16), sample_rate)

then the rendered output is silence:
dd11.webm

Even if I just try loading a .vstpreset:

engine = daw.RenderEngine(sample_rate, 512)
engine.set_bpm(120.)

synth = engine.make_plugin_processor("synth", "/Library/Audio/Plug-Ins/VST3/TAL-BassLine-101.vst3")
synth.load_vst3_preset("presets-TAL_BassLine_101/Solidtrax/Piano/ST_Electric_Piano_01.vstpreset")
for i, p in enumerate(instrument.parameters.keys()):
    synth.set_parameter(i, instrument.__getattr__(p).raw_value)

# (MIDI note, velocity, start sec, duration sec)
synth.add_midi_note(60, 127, 0.0, 1)

engine.load_graph([
  (synth, []),
  ])

engine.render(2.)  # render 4 seconds.
audio = engine.get_audio()

torchaudio.save("dd12.wav", torch.tensor(audio * 32767, dtype=torch.int16), sample_rate)

again, the output is silence
dd12.webm

What am I doing wrong here?

@DBraun
Copy link
Owner

DBraun commented Dec 7, 2023

When you call synth.set_parameter the values should be between 0-1, but I'm not sure that's what instrument.__getattr__(p).raw_value is. Other than that, it looks correct, so there could be a bug.

@DBraun DBraun self-assigned this Dec 7, 2023
@DBraun DBraun added the bug Something isn't working label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants