Why my code is not working? #55
Answered
by
DBraun
charlesneimog
asked this question in
Q&A
-
Hi, I am starting with python, I am not able to understand how the graph work.
How make the audio Thank you very much!!!!! |
Beta Was this translation helpful? Give feedback.
Answered by
DBraun
Oct 7, 2021
Replies: 2 comments 2 replies
-
The main issue is that you need to create a playback processor with Full script: import dawdreamer as daw
import numpy as np
from scipy.io import wavfile
import librosa
SAMPLE_RATE = 44100
BUFFER_SIZE = 512
DURATION = 15
def load_audio_file(file_path, duration=None):
sig, rate = librosa.load(file_path, duration=duration, mono=False, sr=SAMPLE_RATE)
assert(rate == SAMPLE_RATE)
return sig
engine = daw.RenderEngine(SAMPLE_RATE, BUFFER_SIZE)
meu_plugin = engine.make_plugin_processor("plugin", "C:/Users/neimog/OneDrive_usp.br/Documents/Plugins/VST3/dearVR MICRO.vst3")
meu_plugin.set_parameter(0, 45) # override a specific parameter.
print(meu_plugin.get_parameter(0)) # warning, is this actually 45? Probably not. VST parameters are normally between 0 and 1.
print(meu_plugin.get_parameter_name(0))
multi = load_audio_file("C:/USERS/NEIMOG/ONEDRIVE_USP.BR/DOCUMENTS/OpenMusic/OUT-FILES/om-ckn/Fl-mul-G#5-G4+-D6-100-cents.wav-v-stereo.wav")
playback_processor = engine.make_playback_processor("playback", multi)
graph = [
(playback_processor , []), # playback takes no inputs
(meu_plugin, ["playback"])
]
## this also works
#graph = [
# (playback_processor , []), # playback takes no inputs
# (meu_plugin, [playback_processor.get_name()])
#]
engine.load_graph(graph)
engine.render(DURATION)
audio = engine.get_audio()
wavfile.write('my_song2.wav', SAMPLE_RATE, audio.transpose()) # don't forget to transpose! |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
DBraun
-
great, Thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The main issue is that you need to create a playback processor with
engine.make_playback_processor("playback", multi)
I also think that
meu_plugin.set_parameter(0, 45)
won't work well because VST parameters must be between 0 and 1. 45 is outside this range.Full script: