DawDreamer icon indicating copy to clipboard operation
DawDreamer copied to clipboard

Render hangs if no graph is loaded

Open VedantKalbag opened this issue 3 years ago • 4 comments

I am trying to render 5 seconds of audio after loading a synth plugin and adding one MIDI note, but this has been running for several minutes and shows no signs of finishing. Here is the code I am using:

from scipy.io import wavfile
import dawdreamer as daw
import numpy as np
import os
SAMPLE_RATE = 44100

BUFFER_SIZE = 128 # Parameters will undergo automation at this buffer/block size.
PPQN = 960 # Pulses per quarter note.
SYNTH_PLUGIN = os.path.expanduser('~')+"/../../Library/Audio/Plug-Ins/VST/TAL-NoiseMaker.vst" # extensions: .dll, .vst3, .vst, .component
engine = daw.RenderEngine(SAMPLE_RATE, BUFFER_SIZE)

# Make a processor and give it the unique name "my_synth", which we use later.
synth = engine.make_plugin_processor("my_synth", SYNTH_PLUGIN)
synth.load_state('../resources/plugins/params/save_states/BasePad')
synth.add_midi_note(60, 127, 0.5, .25) # (MIDI note, velocity, start, duration)

engine.render(5) # THIS LINE IS WHERE THE CODE GETS STUCK RUNNING FOREVER

output = engine.get_audio()
wavfile.write(f'output.wav', SAMPLE_RATE, output.transpose())

For further context, I am running this on MacOS 10.15.7 with Python 3.10.4

VedantKalbag avatar Sep 06 '22 15:09 VedantKalbag

Interesting, because that plugin is included in the automated tests for macOS: https://github.com/DBraun/DawDreamer/blob/bdc8947dc7aa99e141c0a081d4ba5bf0ccfd73b3/tests/dawdreamer_utils.py#L102

Does it work if you don't call load_state?

Did you call engine.load_graph([(synth, [])])? before render?

Can you try the TAL-NoiseMaker.vst that's included in the repo?

DBraun avatar Sep 06 '22 15:09 DBraun

Adding this has fixed it!

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

Thanks for the quick help!

VedantKalbag avatar Sep 06 '22 15:09 VedantKalbag

No problem. Let's leave this open as a bug in the meanwhile.

DBraun avatar Sep 06 '22 15:09 DBraun

Sure, sorry about that!

VedantKalbag avatar Sep 06 '22 15:09 VedantKalbag

Tested and fixed in 0.6.14. I decided to make it throw a RuntimeError you can catch with a try clause.

DBraun avatar Oct 20 '22 16:10 DBraun