igorgad / dpm

30 stars 5 forks source link

JUCE Assertion failure in vstRender.cpp:31 #2

Closed drscotthawley closed 6 years ago

drscotthawley commented 6 years ago

Hi @igorgad , just checking in again: I just pulled your updates and rebuilt, but I still get a seg fault:

$ python train.py 
/opt/anaconda/envs/py36/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
JUCE v5.2.0
JUCE Assertion failure in vstRender.cpp:31

Segmentation fault (core dumped)

I'm now using the same (mono) plugin you were:

$ python prepare_data.py /usr/lib/vst/ZamEQ2-vst.so --audio_file test_in.wav --outfile test_out.wav
/opt/anaconda/envs/py36/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
JUCE v5.2.0
JUCE Assertion failure in vstRender.cpp:31
JUCE Assertion failure in vstRender.cpp:31
JUCE Assertion failure in vstRender.cpp:31
JUCE Assertion failure in vstRender.cpp:31
JUCE Assertion failure in vstRender.cpp:31
Segmentation fault (core dumped)

The assertion failure seems to occur at vst.loadPlugin e.g. in init_vst() in prepare_data.py:

vst.loadPlugin(plugin_file)

That's as far as I've gotten.... Any ideas?

drscotthawley commented 6 years ago

Ahhhh. Small user error: my plugins got installed in /usr/local/lib/vst, not /usr/lib/vst as on your system.

That was the problem.

With that change and naming my input file music.wav, I get a totally different set of errors. These may be coming from the ZamEQ2 code and not yours:

$ python prepare_data.py /usr/local/lib/vst/ZamEQ2-vst.so --audio_file ./music.wav --outfile ./dpm_music.tfrecord /opt/anaconda/envs/py36/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters JUCE v5.2.0 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 2018-05-30 16:04:46.705455: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1208] Found device 0 with properties: name: TITAN X (Pascal) major: 6 minor: 1 memoryClockRate(GHz): 1.531 pciBusID: 0000:01:00.0 totalMemory: 11.91GiB freeMemory: 11.29GiB 2018-05-30 16:04:46.820382: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1208] Found device 1 with properties: name: TITAN X (Pascal) major: 6 minor: 1 memoryClockRate(GHz): 1.531 pciBusID: 0000:02:00.0 totalMemory: 11.91GiB freeMemory: 11.75GiB 2018-05-30 16:04:46.821245: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1223] Device peer to peer matrix 2018-05-30 16:04:46.821271: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1229] DMA: 0 1 2018-05-30 16:04:46.821277: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1239] 0: Y Y 2018-05-30 16:04:46.821282: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1239] 1: Y Y 2018-05-30 16:04:46.821288: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1308] Adding visible gpu devices: 0, 1 2018-05-30 16:04:47.196004: I tensorflow/core/common_runtime/gpu/gpu_device.cc:989] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10936 MB memory) -> physical GPU (device: 0, name: TITAN X (Pascal), pci bus id: 0000:01:00.0, compute capability: 6.1) 2018-05-30 16:04:47.314033: I tensorflow/core/common_runtime/gpu/gpu_device.cc:989] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 11380 MB memory) -> physical GPU (device: 1, name: TITAN X (Pascal), pci bus id: 0000:02:00.0, compute capability: 6.1) Using audio file to create examples... Traceback (most recent call last): File "prepare_data.py", line 106, in input_samples = sess.run(generate_from_audio(args.audio_file, args.audio_samples)) File "prepare_data.py", line 61, in generate_from_audio waveform = tf.reduce_mean(tf.contrib.ffmpeg.decode_audio(audio_binary, file_format='wav', samples_per_second=44100, channel_count=2), axis=1) File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py", line 53, in getattr module = self._load() File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/lazy_loader.py", line 42, in _load module = importlib.import_module(self.name) File "/opt/anaconda/envs/py36/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 978, in _gcd_import File "", line 961, in _find_and_load File "", line 950, in _find_and_load_unlocked File "", line 655, in _load_unlocked File "", line 678, in exec_module File "", line 205, in _call_with_frames_removed File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/init.py", line 23, in from tensorflow.contrib import bayesflow File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/bayesflow/init.py", line 28, in from tensorflow.contrib.bayesflow.python.ops import layers File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/bayesflow/python/ops/layers.py", line 26, in from tensorflow.contrib.bayesflow.python.ops.layers_conv_variational import File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/bayesflow/python/ops/layers_conv_variational.py", line 22, in from tensorflow.contrib.bayesflow.python.ops import layers_util File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/bayesflow/python/ops/layers_util.py", line 24, in from tensorflow.contrib.distributions.python.ops import deterministic as deterministic_lib File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/distributions/init.py", line 38, in from tensorflow.contrib.distributions.python.ops.estimator import File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/distributions/python/ops/estimator.py", line 21, in from tensorflow.contrib.learn.python.learn.estimators.head import _compute_weighted_loss File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/init.py", line 92, in from tensorflow.contrib.learn.python.learn import File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/init.py", line 23, in from tensorflow.contrib.learn.python.learn import File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/init.py", line 25, in from tensorflow.contrib.learn.python.learn import estimators File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/init.py", line 297, in from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn.py", line 30, in from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 31, in from tensorflow.contrib.learn.python.learn.estimators import estimator File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 47, in from tensorflow.contrib.learn.python.learn.learn_io import data_feeder File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/init.py", line 21, in from tensorflow.contrib.learn.python.learn.learn_io.dask_io import extract_dask_data File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 26, in import dask.dataframe as dd File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/dask/dataframe/init.py", line 3, in from .core import (DataFrame, Series, Index, _Frame, map_partitions, File "/opt/anaconda/envs/py36/lib/python3.6/site-packages/dask/dataframe/core.py", line 41, in pd.core.computation.expressions.set_use_numexpr(False) AttributeError: module 'pandas.core.computation' has no attribute 'expressions'

drscotthawley commented 6 years ago

Ok, that was an error with dask. To fix that,

pip install dask --upgrade

And after that, it runs! The plugin itself generates assertion failures, but the run proceeds to the 'processed step....' part.

$ python prepare_data.py /usr/local/lib/vst/ZamEQ2-vst.so --audio_file ./music.wav --outfile ./dpm_music.tfrecord /opt/anaconda/envs/py36/lib/python3.6/site-packages/h5py/init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters JUCE v5.2.0 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Creating VST instance: ZamEQ2-vst Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0) assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027 Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Attempting to load VST: /usr/local/lib/vst/ZamEQ2-vst.so Creating VST instance: ZamEQ2-vst Creating VST instance: ZamEQ2-vst Initialising VST: ZamEQ2-vst (3.10.0.0)Initialising VST: ZamEQ2-vst (3.10.0.0)

assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027assertion failure: "obj->plugin == nullptr" in file ../../dpf/distrho/src/DistrhoPluginVST.cpp, line 1027

2018-05-30 16:13:48.768294: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1208] Found device 0 with properties: name: TITAN X (Pascal) major: 6 minor: 1 memoryClockRate(GHz): 1.531 pciBusID: 0000:01:00.0 totalMemory: 11.91GiB freeMemory: 11.29GiB 2018-05-30 16:13:48.874709: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1208] Found device 1 with properties: name: TITAN X (Pascal) major: 6 minor: 1 memoryClockRate(GHz): 1.531 pciBusID: 0000:02:00.0 totalMemory: 11.91GiB freeMemory: 11.75GiB 2018-05-30 16:13:48.875580: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1223] Device peer to peer matrix 2018-05-30 16:13:48.875608: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1229] DMA: 0 1 2018-05-30 16:13:48.875613: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1239] 0: Y Y 2018-05-30 16:13:48.875617: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1239] 1: Y Y 2018-05-30 16:13:48.875625: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1308] Adding visible gpu devices: 0, 1 2018-05-30 16:13:49.248370: I tensorflow/core/common_runtime/gpu/gpu_device.cc:989] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 10936 MB memory) -> physical GPU (device: 0, name: TITAN X (Pascal), pci bus id: 0000:01:00.0, compute capability: 6.1) 2018-05-30 16:13:49.366553: I tensorflow/core/common_runtime/gpu/gpu_device.cc:989] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 11380 MB memory) -> physical GPU (device: 1, name: TITAN X (Pascal), pci bus id: 0000:02:00.0, compute capability: 6.1) Using audio file to create examples... processed step ex: 0 from 200 in 0.9523403644561768 processed step ex: 1 from 200 in 0.2847597599029541 processed step ex: 2 from 200 in 0.2251136302947998 processed step ex: 3 from 200 in 0.20030856132507324 processed step ex: 4 from 200 in 0.29308652877807617 processed step ex: 5 from 200 in 0.2215573787689209 processed step ex: 6 from 200 in 0.17699003219604492 processed step ex: 7 from 200 in 0.17791247367858887 processed step ex: 8 from 200 in 0.19803452491760254 processed step ex: 9 from 200 in 0.1836690902709961 processed step ex: 10 from 200 in 0.23997044563293457 processed step ex: 11 from 200 in 0.22041559219360352 processed step ex: 12 from 200 in 0.20663809776306152 processed step ex: 13 from 200 in 0.2049424648284912 processed step ex: 14 from 200 in 0.24372649192810059 processed step ex: 15 from 200 in 0.24802136421203613 processed step ex: 16 from 200 in 0.27324557304382324 processed step ex: 17 from 200 in 0.250063419342041 processed step ex: 18 from 200 in 0.27149438858032227 processed step ex: 19 from 200 in 0.26868486404418945 processed step ex: 20 from 200 in 0.2345736026763916 processed step ex: 21 from 200 in 0.2023627758026123 processed step ex: 22 from 200 in 0.19823694229125977 processed step ex: 23 from 200 in 0.2335817813873291 processed step ex: 24 from 200 in 0.27477383613586426 processed step ex: 25 from 200 in 0.2682068347930908 processed step ex: 26 from 200 in 0.29837465286254883 processed step ex: 27 from 200 in 0.2841629981994629 processed step ex: 28 from 200 in 0.21511268615722656 processed step ex: 29 from 200 in 0.296283483505249 processed step ex: 30 from 200 in 0.2152540683746338 processed step ex: 31 from 200 in 0.26171398162841797 processed step ex: 32 from 200 in 0.2235393524169922 processed step ex: 33 from 200 in 0.2317357063293457 processed step ex: 34 from 200 in 0.22371912002563477 processed step ex: 35 from 200 in 0.2774043083190918 processed step ex: 36 from 200 in 0.23777985572814941 processed step ex: 37 from 200 in 0.2733638286590576 processed step ex: 38 from 200 in 0.22588276863098145 processed step ex: 39 from 200 in 0.22378182411193848 processed step ex: 40 from 200 in 0.27648234367370605 processed step ex: 41 from 200 in 0.25223445892333984 processed step ex: 42 from 200 in 0.2242567539215088 processed step ex: 43 from 200 in 0.35991406440734863 processed step ex: 44 from 200 in 0.2352008819580078 processed step ex: 45 from 200 in 0.28881072998046875 processed step ex: 46 from 200 in 0.23182439804077148 processed step ex: 47 from 200 in 0.30406808853149414 processed step ex: 48 from 200 in 0.28194570541381836 processed step ex: 49 from 200 in 0.3113589286804199 processed step ex: 50 from 200 in 0.3076162338256836 processed step ex: 51 from 200 in 0.30985569953918457 processed step ex: 52 from 200 in 0.31047868728637695 processed step ex: 53 from 200 in 0.33117127418518066 processed step ex: 54 from 200 in 0.31505680084228516 processed step ex: 55 from 200 in 0.30779409408569336 processed step ex: 56 from 200 in 0.3006887435913086 processed step ex: 57 from 200 in 0.30066347122192383 processed step ex: 58 from 200 in 0.3054485321044922 processed step ex: 59 from 200 in 0.32883667945861816 processed step ex: 60 from 200 in 0.2911198139190674 processed step ex: 61 from 200 in 0.25438761711120605 processed step ex: 62 from 200 in 0.3355743885040283 processed step ex: 63 from 200 in 0.3249378204345703 processed step ex: 64 from 200 in 0.3313710689544678 processed step ex: 65 from 200 in 0.2711186408996582 processed step ex: 66 from 200 in 0.34682798385620117 processed step ex: 67 from 200 in 0.37964677810668945 processed step ex: 68 from 200 in 0.3828094005584717 processed step ex: 69 from 200 in 0.34026575088500977 processed step ex: 70 from 200 in 0.34688782691955566 processed step ex: 71 from 200 in 0.34626054763793945 processed step ex: 72 from 200 in 0.35454320907592773 processed step ex: 73 from 200 in 0.40480899810791016 processed step ex: 74 from 200 in 0.4107067584991455 processed step ex: 75 from 200 in 0.41829442977905273 processed step ex: 76 from 200 in 0.41425490379333496 processed step ex: 77 from 200 in 0.40291404724121094 processed step ex: 78 from 200 in 0.39536547660827637 processed step ex: 79 from 200 in 0.3468475341796875 processed step ex: 80 from 200 in 0.3163797855377197 processed step ex: 81 from 200 in 0.31844043731689453 processed step ex: 82 from 200 in 0.3211100101470947 processed step ex: 83 from 200 in 0.3381640911102295 processed step ex: 84 from 200 in 0.4335334300994873 processed step ex: 85 from 200 in 0.3469259738922119 processed step ex: 86 from 200 in 0.30417370796203613 processed step ex: 87 from 200 in 0.3380873203277588 processed step ex: 88 from 200 in 0.36872291564941406 processed step ex: 89 from 200 in 0.40987730026245117 processed step ex: 90 from 200 in 0.3698916435241699 processed step ex: 91 from 200 in 0.36954164505004883 processed step ex: 92 from 200 in 0.36286211013793945 processed step ex: 93 from 200 in 0.38328981399536133 processed step ex: 94 from 200 in 0.38188934326171875 processed step ex: 95 from 200 in 0.33460545539855957 processed step ex: 96 from 200 in 0.346433162689209 processed step ex: 97 from 200 in 0.31975603103637695 processed step ex: 98 from 200 in 0.3305790424346924 processed step ex: 99 from 200 in 0.30705714225769043 processed step ex: 100 from 200 in 0.35242724418640137 processed step ex: 101 from 200 in 0.37186241149902344 processed step ex: 102 from 200 in 0.3957090377807617 processed step ex: 103 from 200 in 0.4044458866119385 processed step ex: 104 from 200 in 0.3564779758453369 processed step ex: 105 from 200 in 0.35094475746154785 processed step ex: 106 from 200 in 0.32726621627807617 processed step ex: 107 from 200 in 0.3354663848876953 processed step ex: 108 from 200 in 0.38198399543762207 processed step ex: 109 from 200 in 0.34745144844055176 processed step ex: 110 from 200 in 0.3206343650817871 processed step ex: 111 from 200 in 0.41162824630737305 processed step ex: 112 from 200 in 0.35258936882019043 processed step ex: 113 from 200 in 0.35863733291625977 processed step ex: 114 from 200 in 0.4260594844818115 processed step ex: 115 from 200 in 0.34047746658325195 processed step ex: 116 from 200 in 0.3328077793121338 processed step ex: 117 from 200 in 0.4057033061981201 processed step ex: 118 from 200 in 0.32608723640441895 processed step ex: 119 from 200 in 0.33058643341064453 processed step ex: 120 from 200 in 0.31145572662353516 processed step ex: 121 from 200 in 0.36016058921813965 processed step ex: 122 from 200 in 0.35884976387023926 processed step ex: 123 from 200 in 0.37160348892211914 processed step ex: 124 from 200 in 0.4413642883300781 processed step ex: 125 from 200 in 0.39360761642456055 processed step ex: 126 from 200 in 0.4386606216430664 processed step ex: 127 from 200 in 0.4010050296783447 processed step ex: 128 from 200 in 0.43012046813964844 processed step ex: 129 from 200 in 0.46422791481018066 processed step ex: 130 from 200 in 0.40663957595825195 processed step ex: 131 from 200 in 0.4091038703918457 processed step ex: 132 from 200 in 0.43462109565734863 processed step ex: 133 from 200 in 0.4074976444244385 processed step ex: 134 from 200 in 0.4458799362182617 processed step ex: 135 from 200 in 0.3862192630767822 processed step ex: 136 from 200 in 0.4167478084564209 processed step ex: 137 from 200 in 0.3902876377105713 processed step ex: 138 from 200 in 0.3898911476135254 processed step ex: 139 from 200 in 0.4413597583770752 processed step ex: 140 from 200 in 0.43930673599243164 processed step ex: 141 from 200 in 0.4206664562225342 processed step ex: 142 from 200 in 0.4255967140197754 processed step ex: 143 from 200 in 0.3781452178955078 processed step ex: 144 from 200 in 0.446366548538208 processed step ex: 145 from 200 in 0.37830615043640137 processed step ex: 146 from 200 in 0.4302222728729248 processed step ex: 147 from 200 in 0.39496588706970215 processed step ex: 148 from 200 in 0.4644596576690674 processed step ex: 149 from 200 in 0.46407246589660645 processed step ex: 150 from 200 in 0.3940572738647461 processed step ex: 151 from 200 in 0.41859006881713867 processed step ex: 152 from 200 in 0.45439887046813965 processed step ex: 153 from 200 in 0.4909374713897705 processed step ex: 154 from 200 in 0.5041425228118896 processed step ex: 155 from 200 in 0.4733254909515381 processed step ex: 156 from 200 in 0.5104632377624512 processed step ex: 157 from 200 in 0.5481102466583252 processed step ex: 158 from 200 in 0.6024601459503174 processed step ex: 159 from 200 in 0.5579969882965088 processed step ex: 160 from 200 in 0.5492513179779053 processed step ex: 161 from 200 in 0.5156500339508057 processed step ex: 162 from 200 in 0.5403478145599365 processed step ex: 163 from 200 in 0.5465757846832275 processed step ex: 164 from 200 in 0.5414290428161621 processed step ex: 165 from 200 in 0.55660080909729 processed step ex: 166 from 200 in 0.5512754917144775 processed step ex: 167 from 200 in 0.5680439472198486 processed step ex: 168 from 200 in 0.5656907558441162 processed step ex: 169 from 200 in 0.5686161518096924 processed step ex: 170 from 200 in 0.5126953125 processed step ex: 171 from 200 in 0.5299327373504639 processed step ex: 172 from 200 in 0.5158910751342773 processed step ex: 173 from 200 in 0.5568544864654541 processed step ex: 174 from 200 in 0.4751095771789551 processed step ex: 175 from 200 in 0.5040955543518066 processed step ex: 176 from 200 in 0.5379238128662109 processed step ex: 177 from 200 in 0.5587389469146729 processed step ex: 178 from 200 in 0.683584451675415 processed step ex: 179 from 200 in 0.5590426921844482 processed step ex: 180 from 200 in 0.5745203495025635 processed step ex: 181 from 200 in 0.5372409820556641 processed step ex: 182 from 200 in 0.569800853729248 processed step ex: 183 from 200 in 0.5881245136260986 processed step ex: 184 from 200 in 0.5814089775085449 processed step ex: 185 from 200 in 0.5825486183166504 processed step ex: 186 from 200 in 0.5776588916778564 processed step ex: 187 from 200 in 0.5388212203979492 processed step ex: 188 from 200 in 0.4318821430206299 processed step ex: 189 from 200 in 0.4405341148376465 processed step ex: 190 from 200 in 0.4972419738769531 processed step ex: 191 from 200 in 0.5157642364501953 processed step ex: 192 from 200 in 0.5474963188171387 processed step ex: 193 from 200 in 0.5193023681640625 processed step ex: 194 from 200 in 0.5479512214660645 processed step ex: 195 from 200 in 0.6107778549194336 processed step ex: 196 from 200 in 0.6146738529205322 processed step ex: 197 from 200 in 0.5937168598175049 processed step ex: 198 from 200 in 0.6043798923492432 processed step ex: 199 from 200 in 0.5899827480316162

A different plugin doesn't produce the assertion errors, but hangs before the generation occurs.

Will try other plugins and update this later.

drscotthawley commented 6 years ago

Got one: Used Faust's simple (mono) delay example (https://github.com/grame-cncm/faust/blob/master-dev/examples/delayEcho/echo.dsp), compiled using their online compiler (http://faust.grame.fr/onlinecompiler/) as "vst-64bits", generates no errors or warnings!

JUCE v5.2.0 Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Creating VST instance: faust_delay Initialising VST: faust_delay (1.0.0.0) Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Creating VST instance: faust_delay Initialising VST: faust_delay (1.0.0.0) Creating VST instance: faust_delay Initialising VST: faust_delay (1.0.0.0) Creating VST instance: faust_delay Creating VST instance: faust_delay Initialising VST: faust_delay (1.0.0.0) Initialising VST: faust_delay (1.0.0.0) Creating VST instance: faust_delay Initialising VST: faust_delay (1.0.0.0) Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Attempting to load VST: /home/shawley/vst-dpm/faust_delay.so Creating VST instance: faust_delay Creating VST instance: faust_delay Initialising VST: faust_delay (1.0.0.0) Initialising VST: faust_delay (1.0.0.0) Creating VST instance: faust_delay Creating VST instance: faust_delay Initialising VST: faust_delay (1.0.0.0) Initialising VST: faust_delay (1.0.0.0) 2018-05-30 16:47:34.615648: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1208] Found device 0 with properties: name: TITAN X (Pascal) major: 6 minor: 1 memoryClockRate(GHz): 1.531 pciBusID: 0000:01:00.0 totalMemory: 11.91GiB freeMemory: 11.45GiB 2018-05-30 16:47:34.739348: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1208] Found device 1 with properties: name: TITAN X (Pascal) major: 6 minor: 1 memoryClockRate(GHz): 1.531 pciBusID: 0000:02:00.0 totalMemory: 11.91GiB freeMemory: 11.75GiB 2018-05-30 16:47:34.740313: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1223] Device peer to peer matrix 2018-05-30 16:47:34.740342: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1229] DMA: 0 1 2018-05-30 16:47:34.740349: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1239] 0: Y Y 2018-05-30 16:47:34.740352: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1239] 1: Y Y 2018-05-30 16:47:34.740365: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1308] Adding visible gpu devices: 0, 1 2018-05-30 16:47:35.145970: I tensorflow/core/common_runtime/gpu/gpu_device.cc:989] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 11091 MB memory) -> physical GPU (device: 0, name: TITAN X (Pascal), pci bus id: 0000:01:00.0, compute capability: 6.1) 2018-05-30 16:47:35.277265: I tensorflow/core/common_runtime/gpu/gpu_device.cc:989] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:1 with 11380 MB memory) -> physical GPU (device: 1, name: TITAN X (Pascal), pci bus id: 0000:02:00.0, compute capability: 6.1) Using audio file to create examples... processed step ex: 0 from 200 in 0.9687457084655762 processed step ex: 1 from 200 in 0.31971144676208496 processed step ex: 2 from 200 in 0.3038177490234375 processed step ex: 3 from 200 in 0.3079102039337158 processed step ex: 4 from 200 in 0.27920985221862793 processed step ex: 5 from 200 in 0.31113100051879883 processed step ex: 6 from 200 in 0.30124831199645996 processed step ex: 7 from 200 in 0.32241320610046387 processed step ex: 8 from 200 in 0.3097352981567383 processed step ex: 9 from 200 in 0.22588038444519043 processed step ex: 10 from 200 in 0.2866201400756836 processed step ex: 11 from 200 in 0.20652341842651367 processed step ex: 12 from 200 in 0.20000529289245605 processed step ex: 13 from 200 in 0.3170192241668701 processed step ex: 14 from 200 in 0.25244927406311035 processed step ex: 15 from 200 in 0.2742466926574707 processed step ex: 16 from 200 in 0.28368377685546875 processed step ex: 17 from 200 in 0.25296854972839355 processed step ex: 18 from 200 in 0.2850656509399414 processed step ex: 19 from 200 in 0.21136164665222168 processed step ex: 20 from 200 in 0.23795819282531738 processed step ex: 21 from 200 in 0.2474682331085205 processed step ex: 22 from 200 in 0.24643754959106445 processed step ex: 23 from 200 in 0.263965368270874 processed step ex: 24 from 200 in 0.282731294631958 processed step ex: 25 from 200 in 0.2666165828704834 processed step ex: 26 from 200 in 0.22292280197143555 processed step ex: 27 from 200 in 0.259563684463501 processed step ex: 28 from 200 in 0.2710154056549072 processed step ex: 29 from 200 in 0.27077627182006836 processed step ex: 30 from 200 in 0.259934663772583 processed step ex: 31 from 200 in 0.2780163288116455 processed step ex: 32 from 200 in 0.25338244438171387 processed step ex: 33 from 200 in 0.28559255599975586 processed step ex: 34 from 200 in 0.2392113208770752 processed step ex: 35 from 200 in 0.24565744400024414 processed step ex: 36 from 200 in 0.27683162689208984 processed step ex: 37 from 200 in 0.25298190116882324 processed step ex: 38 from 200 in 0.24212431907653809 processed step ex: 39 from 200 in 0.25524282455444336 processed step ex: 40 from 200 in 0.2294614315032959 processed step ex: 41 from 200 in 0.28511834144592285 processed step ex: 42 from 200 in 0.337979793548584 processed step ex: 43 from 200 in 0.3730769157409668 processed step ex: 44 from 200 in 0.31097841262817383 processed step ex: 45 from 200 in 0.31223082542419434 processed step ex: 46 from 200 in 0.2928473949432373 processed step ex: 47 from 200 in 0.33007359504699707 processed step ex: 48 from 200 in 0.29758477210998535 processed step ex: 49 from 200 in 0.29831480979919434 processed step ex: 50 from 200 in 0.23718690872192383 processed step ex: 51 from 200 in 0.28589582443237305 processed step ex: 52 from 200 in 0.32524728775024414 processed step ex: 53 from 200 in 0.3022761344909668 processed step ex: 54 from 200 in 0.3541419506072998 processed step ex: 55 from 200 in 0.372722864151001 processed step ex: 56 from 200 in 0.30788564682006836 processed step ex: 57 from 200 in 0.312471866607666 processed step ex: 58 from 200 in 0.3317992687225342 processed step ex: 59 from 200 in 0.3274874687194824 processed step ex: 60 from 200 in 0.26193857192993164 processed step ex: 61 from 200 in 0.33216214179992676 processed step ex: 62 from 200 in 0.34192347526550293 processed step ex: 63 from 200 in 0.28447794914245605 processed step ex: 64 from 200 in 0.3198890686035156 processed step ex: 65 from 200 in 0.3805367946624756 processed step ex: 66 from 200 in 0.41137099266052246 processed step ex: 67 from 200 in 0.3780217170715332 processed step ex: 68 from 200 in 0.3306543827056885 processed step ex: 69 from 200 in 0.2721860408782959 processed step ex: 70 from 200 in 0.368757963180542 processed step ex: 71 from 200 in 0.4186098575592041 processed step ex: 72 from 200 in 0.35753893852233887 processed step ex: 73 from 200 in 0.414827823638916 processed step ex: 74 from 200 in 0.34223389625549316 processed step ex: 75 from 200 in 0.4056832790374756 processed step ex: 76 from 200 in 0.3779489994049072 processed step ex: 77 from 200 in 0.3358175754547119 processed step ex: 78 from 200 in 0.33309006690979004 processed step ex: 79 from 200 in 0.3429138660430908 processed step ex: 80 from 200 in 0.34140753746032715 processed step ex: 81 from 200 in 0.2938418388366699 processed step ex: 82 from 200 in 0.27393341064453125 processed step ex: 83 from 200 in 0.3286929130554199 processed step ex: 84 from 200 in 0.36487817764282227 processed step ex: 85 from 200 in 0.34537267684936523 processed step ex: 86 from 200 in 0.34532713890075684 processed step ex: 87 from 200 in 0.2804734706878662 processed step ex: 88 from 200 in 0.2805452346801758 processed step ex: 89 from 200 in 0.353485107421875 processed step ex: 90 from 200 in 0.37237548828125 processed step ex: 91 from 200 in 0.36923813819885254 processed step ex: 92 from 200 in 0.36723995208740234 processed step ex: 93 from 200 in 0.37182044982910156 processed step ex: 94 from 200 in 0.35212254524230957 processed step ex: 95 from 200 in 0.3300468921661377 processed step ex: 96 from 200 in 0.44437241554260254 processed step ex: 97 from 200 in 0.38358640670776367 processed step ex: 98 from 200 in 0.3934288024902344 processed step ex: 99 from 200 in 0.3887801170349121 processed step ex: 100 from 200 in 0.4248921871185303 processed step ex: 101 from 200 in 0.4309272766113281 processed step ex: 102 from 200 in 0.4361104965209961 processed step ex: 103 from 200 in 0.36748623847961426 processed step ex: 104 from 200 in 0.41754674911499023 processed step ex: 105 from 200 in 0.38190388679504395 processed step ex: 106 from 200 in 0.39922332763671875 processed step ex: 107 from 200 in 0.4523470401763916 processed step ex: 108 from 200 in 0.447829008102417 processed step ex: 109 from 200 in 0.4707300662994385 processed step ex: 110 from 200 in 0.47336912155151367 processed step ex: 111 from 200 in 0.4386763572692871 processed step ex: 112 from 200 in 0.37853002548217773 processed step ex: 113 from 200 in 0.3321223258972168 processed step ex: 114 from 200 in 0.41678380966186523 processed step ex: 115 from 200 in 0.43501758575439453 processed step ex: 116 from 200 in 0.4736146926879883 processed step ex: 117 from 200 in 0.47144079208374023 processed step ex: 118 from 200 in 0.45406675338745117 processed step ex: 119 from 200 in 0.47266459465026855 processed step ex: 120 from 200 in 0.4418766498565674 processed step ex: 121 from 200 in 0.3740363121032715 processed step ex: 122 from 200 in 0.38611292839050293 processed step ex: 123 from 200 in 0.42839646339416504 processed step ex: 124 from 200 in 0.45546936988830566 processed step ex: 125 from 200 in 0.4893343448638916 processed step ex: 126 from 200 in 0.5726332664489746 processed step ex: 127 from 200 in 0.42833995819091797 processed step ex: 128 from 200 in 0.46005940437316895 processed step ex: 129 from 200 in 0.4009063243865967 processed step ex: 130 from 200 in 0.45723652839660645 processed step ex: 131 from 200 in 0.4292769432067871 processed step ex: 132 from 200 in 0.4121253490447998 processed step ex: 133 from 200 in 0.5038244724273682 processed step ex: 134 from 200 in 0.3967907428741455 processed step ex: 135 from 200 in 0.4099762439727783 processed step ex: 136 from 200 in 0.4162914752960205 processed step ex: 137 from 200 in 0.4161384105682373 processed step ex: 138 from 200 in 0.41936349868774414 processed step ex: 139 from 200 in 0.46267271041870117 processed step ex: 140 from 200 in 0.5053999423980713 processed step ex: 141 from 200 in 0.4670734405517578 processed step ex: 142 from 200 in 0.4692873954772949 processed step ex: 143 from 200 in 0.4918820858001709 processed step ex: 144 from 200 in 0.4991180896759033 processed step ex: 145 from 200 in 0.48005056381225586 processed step ex: 146 from 200 in 0.4999542236328125 processed step ex: 147 from 200 in 0.5174856185913086 processed step ex: 148 from 200 in 0.5225088596343994 processed step ex: 149 from 200 in 0.463592529296875 processed step ex: 150 from 200 in 0.5239205360412598 processed step ex: 151 from 200 in 0.43095993995666504 processed step ex: 152 from 200 in 0.45697808265686035 processed step ex: 153 from 200 in 0.49353575706481934 processed step ex: 154 from 200 in 0.49367761611938477 processed step ex: 155 from 200 in 0.46259427070617676 processed step ex: 156 from 200 in 0.4293220043182373 processed step ex: 157 from 200 in 0.48186326026916504 processed step ex: 158 from 200 in 0.49124693870544434 processed step ex: 159 from 200 in 0.4712083339691162 processed step ex: 160 from 200 in 0.47977328300476074 processed step ex: 161 from 200 in 0.45224428176879883 processed step ex: 162 from 200 in 0.4113640785217285 processed step ex: 163 from 200 in 0.46173095703125 processed step ex: 164 from 200 in 0.3919084072113037 processed step ex: 165 from 200 in 0.45646238327026367 processed step ex: 166 from 200 in 0.4527575969696045 processed step ex: 167 from 200 in 0.4714505672454834 processed step ex: 168 from 200 in 0.5141968727111816 processed step ex: 169 from 200 in 0.43105268478393555 processed step ex: 170 from 200 in 0.4892160892486572 processed step ex: 171 from 200 in 0.4760091304779053 processed step ex: 172 from 200 in 0.4700448513031006 processed step ex: 173 from 200 in 0.4400291442871094 processed step ex: 174 from 200 in 0.4558858871459961 processed step ex: 175 from 200 in 0.43341517448425293 processed step ex: 176 from 200 in 0.44385194778442383 processed step ex: 177 from 200 in 0.42621350288391113 processed step ex: 178 from 200 in 0.6074268817901611 processed step ex: 179 from 200 in 0.515629768371582 processed step ex: 180 from 200 in 0.5200331211090088 processed step ex: 181 from 200 in 0.5347087383270264 processed step ex: 182 from 200 in 0.4861633777618408 processed step ex: 183 from 200 in 0.5145065784454346 processed step ex: 184 from 200 in 0.5238041877746582 processed step ex: 185 from 200 in 0.5011107921600342 processed step ex: 186 from 200 in 0.540276288986206 processed step ex: 187 from 200 in 0.5162069797515869 processed step ex: 188 from 200 in 0.5791280269622803 processed step ex: 189 from 200 in 0.4729881286621094 processed step ex: 190 from 200 in 0.5762457847595215 processed step ex: 191 from 200 in 0.47705078125 processed step ex: 192 from 200 in 0.5014371871948242 processed step ex: 193 from 200 in 0.5467205047607422 processed step ex: 194 from 200 in 0.5851171016693115 processed step ex: 195 from 200 in 0.5714130401611328 processed step ex: 196 from 200 in 0.5150272846221924 processed step ex: 197 from 200 in 0.5391824245452881 processed step ex: 198 from 200 in 0.5222194194793701 processed step ex: 199 from 200 in 0.4812889099121094

I look forward to (making my student) experiment with this. :-) Thanks Igor.

It occurs to me that, one other option one could try for talking to a VST host from within python: socket connections.

igorgad commented 6 years ago

Hi Scott, that's nice. Thank you for the feedback! I do have some assertion errors with a few plugins, but they seem to run fine in the end.

Yes, I believe socket connections are a nice option if you want real-time processing, or maybe a jack interface. However, this is not a priority for this project, sorry. The main objective of this project is to model vst systems with Neural Networks, a very difficult task by the way.

Anyway, feel free to submit changes to this code, maybe with some VST hosting idea or with some NN model :-)

drscotthawley commented 6 years ago

I agree, it's a very difficult task -- I've been working on it for 2 or 3 years!

In case you or any future users would like to see: I created a very-simplified version to demonstrate calling the vstRender routine. I removed the tensorflow and multiprocessing, and I put it in one class for convenience. Only real dependency is librosa which I think many audio developers would be ok with. If you like this, feel free to add it to dpm, or I can fork and send a PR, or if not that's fine too. It's not optimized for production, just for seeing 'how to use it'.

$ cat run_plugin.py

#! /usr/bin/env python3
# Author: Scott Hawley
# Source: Igor Gadelha  https://github.com/igorgad/dpm/blob/master/prepare_data.py

# Used simple echo plugin from Faust examples, https://github.com/grame-cncm/faust/blob/master-dev/examples/delayEcho/echo.dsp
# Pasted source into Faust Online Compiler https://faust.grame.fr/onlinecompiler/
# and Generated exec file for Linux, 'vst-64bits' architecture

import numpy as np
import vstRender.vstRender as vr
import librosa
import argparse
import os

class Plugin():
    def __init__(self, plugin_file,sr=44100):
        # make sure the plugin file exists
        assert os.path.isfile(plugin_file), "Error, plugin file "+plugin_file+" not found"
        self.vst = vr.vstRender(sr, 512)
        self.vst.loadPlugin(plugin_file)

        # get vst parameters ('knob' names, etc)
        self.nparams = self.vst.getPluginParameterSize()
        self.params_description = self.vst.getPluginParametersDescription()
        self.params_description = [[int(i.split(':')[0]), i.split(':')[1].replace(' ', ''), float(i.split(':')[2]), int(i.split(':')[3])]
                              for i in self.params_description.split('\n')[:-1]]

    def ___vst_process_samples(self, samples, params):
        """where the actual audio processing call happens (private method)"""
        pidx = params[0]    # list of knob numbers
        pval = params[1]    # list of knob settings for each knob

        # match param numbers with param values
        parg = tuple([(int(i), float(j)) for i, j in zip(pidx, pval)])

        self.vst.setParams(parg)       # set plugin parameters
        audio = samples.copy()         # renderAudio operates 'in place', so make a copy
        self.vst.renderAudio(audio)
        return audio

    def run(self, audio_in, params):
        """call the plugin to apply to the audio"""
        audio_out = self.__vst_process_samples(audio_in, params).astype(np.float32)
        return audio_out

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--plugin_file', type=str, default='./faust_delay.so', help='plugin to model')
    parser.add_argument('--audio_file', default='./music.wav', type=str, help='audio file to read from')
    parser.add_argument('--outfile', default='./vst_out.wav', type=str, help='output file to create')
    parser.add_argument('--sr', default=44100, type=int, help='sample rate in Hertz')

    args = parser.parse_args()

    print("Initializing plugin file",args.plugin_file)
    plugin = Plugin(args.plugin_file)     # load and initialize the plugin
    print("   Plugin: nparams =",plugin.nparams)
    print("   Plugin: params_description =",plugin.params_description)

    # make sure the audio file exists
    assert os.path.isfile(args.audio_file), "Error, audio file "+args.audio_file+" not found"

    print ('Reading audio from',args.audio_file)
    audio_in, sr = librosa.core.load(args.audio_file, args.sr, mono=True)

    # set parameter values (randomly)
    pidx = np.arange(plugin.nparams)           # indices for parameters
    pval = np.random.random([plugin.nparams])  # values for those parameters
    params = [pidx, pval]

    audio_out = plugin.run(audio_in, params)   # apply the plugin to input audio

    print("Writing output to",args.outfile)
    librosa.output.write_wav(args.outfile, audio_out, args.sr)
igorgad commented 6 years ago

Hi Scott, I just added the run_plugin.py file to the dpm repository. Thanks for the contribution.

drscotthawley commented 6 years ago

Great! I just made a few minor edits of moving things around and added a few more comments. I'll send you a PR for that one file in contrib/