magenta / ddsp-vst

Realtime DDSP Neural Synthesizer and Effect
Apache License 2.0
724 stars 72 forks source link

GNU/Linux Support? #22

Open jaarac opened 2 years ago

jaarac commented 2 years ago

Do you plan to support GNU/Linux like SO?

un1tz3r0 commented 2 years ago

i second this, some linux vsts we could use with eg bitwig would be really great

PhysSong commented 2 years ago

I've managed to build DDSP-VST on Arch Linux with the following changes. I'm not sure if all of them are really required, though.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6b24687..385c0d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,11 +44,16 @@ add_subdirectory(externals/JUCE "${CMAKE_CURRENT_BINARY_DIR}/juce-bin" EXCLUDE_F
 add_subdirectory(externals/tensorflow/tensorflow/lite "${CMAKE_CURRENT_BINARY_DIR}/tensorflow-lite-bin" EXCLUDE_FROM_ALL)
 # TFLite CXX std needs to be explicitly set to C++20 in Visual Studio.
 target_compile_features(tensorflow-lite PUBLIC ${DDSP_CXX_STD})
-target_compile_options(tensorflow-lite PUBLIC -stdlib=libc++)
+if(APPLE)
+    target_compile_options(tensorflow-lite PUBLIC -stdlib=libc++)
+endif()

 # ------------------------- DDSP Binary Assets ------------------------ #

 juce_add_binary_data(Assets SOURCES ${DDSP_ASSETS})
+if("${CMAKE_SYSTEM}" MATCHES "Linux")
+    set_target_properties(Assets PROPERTIES POSITION_INDEPENDENT_CODE ON)
+endif()

 # ---------------------------- DDSP Effect ---------------------------- #

diff --git a/src/audio/tflite/PredictControlsModel.cpp b/src/audio/tflite/PredictControlsModel.cpp
index 4dcf3a5..d3fbd36 100644
--- a/src/audio/tflite/PredictControlsModel.cpp
+++ b/src/audio/tflite/PredictControlsModel.cpp
@@ -14,6 +14,8 @@ See the License for the specific language governing permissions and
 limitations under the License.
 */

+#include <cmath>
+
 #include "audio/tflite/PredictControlsModel.h"
 #include "util/Constants.h"

@@ -96,7 +98,7 @@ void PredictControlsModel::call (const AudioFeatures& input, SynthesisControls&

     for (int i = 0; i < kHarmonicsSize; ++i)
     {
-        if (isnan (output.harmonics[i]))
+        if (std::isnan (output.harmonics[i]))
         {
             DBG ("is_nan");
             output.harmonics[i] = 0.f;

If you get error: 'exchange' is not a member of 'std'(with GCC 12), try applying https://github.com/juce-framework/JUCE/commit/ce8aff22c31c4d932a8414bc6f6185381dc970db to external/JUCE.

Mec-iS commented 1 year ago

@PhysSong You should make your changes into a PR, I would be glad to add the documentation part. Your solution works well for me on Ubuntu 22 LTS.

Taikakim commented 1 year ago

Hmm this is very interesting. I've been trying it out through Yabridge now, and it seems to work not so well. The pitch tracking flips out a lot, and the UI is quite sticky. Also I can't figure out how to load in the models I trained.

So in that code red ones are to be removed and green ones added? But I think for me this is too complicated, I don't even know what all the prerequisites for compiling under Linux are... So I root for an official version too :)

Mec-iS commented 1 year ago

Hi, there is not need to use emulation with Wine (that is what Yabridge does as far as I understood). These are the prerequisites:

  1. a real-time or low-latency kernel
  2. Ardour or other native DAW
  3. check that all the dependencies are installed on your system (missing libraries warnings are issued at compilation)
  4. compile the plugin in your machine using the existing Makefile

So basically for 4.:

  1. apply the changes to the files as specified above
  2. Run make in the directory where the Makefile is, a compiled VST3 plugin is generated in the build directory.
  3. Copy the plugin directory in the system's VST3 path
Taikakim commented 1 year ago

Ok, I will try that, I also heard just today that someone on the Linux Musicians FB group succesfully compiled this. I will try this out, thanks!

Taikakim commented 1 year ago

Hmm there is no Makefile, if I just run Git Clone on the repo, there is only the cmake directory, and running the repo-init script gives also errors. Also, I have no idea about what arguments to pass to cmake.

~~~ DDSP JUCE ~~~

Setting up dependencies ...

Submodule 'externals/JUCE' (git@github.com:juce-framework/JUCE.git) registered for path 'externals/JUCE'
Submodule 'externals/tensorflow' (git@github.com:tensorflow/tensorflow.git) registered for path 'externals/tensorflow'
Cloning into '/home/kim/Downloads/ddsp/ddsp-vst/externals/JUCE'...
The authenticity of host 'github.com (140.82.121.4)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? y
Please type 'yes', 'no' or the fingerprint: yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:juce-framework/JUCE.git' into submodule path '/home/kim/Downloads/ddsp/ddsp-vst/externals/JUCE' failed
Failed to clone 'externals/JUCE'. Retry scheduled
Cloning into '/home/kim/Downloads/ddsp/ddsp-vst/externals/tensorflow'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:tensorflow/tensorflow.git' into submodule path '/home/kim/Downloads/ddsp/ddsp-vst/externals/tensorflow' failed
Failed to clone 'externals/tensorflow'. Retry scheduled
Cloning into '/home/kim/Downloads/ddsp/ddsp-vst/externals/JUCE'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:juce-framework/JUCE.git' into submodule path '/home/kim/Downloads/ddsp/ddsp-vst/externals/JUCE' failed
Failed to clone 'externals/JUCE' a second time, aborting

Downloading DDSP TF Lite Models ...

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 73.1M  100 73.1M    0     0  5779k      0  0:00:12  0:00:12 --:--:-- 6388k

DDSP TF Lite Models downloaded to models/ddsp/
tank-trax commented 1 year ago

I have successfully compiled this on Debian 11. I followed the instructions and also made a few changes to add JACK support for the standalone. I could create a PR and send it over for review.

There were a few steps I needed to follow based on experience that were not in the instructions which I could also add.

I had a similar issue with trying to update the submodules where it constantly asked for SSH permissions, eventually they updated, as a failsafe, not sure if it helped or not, for JUCE and Tensorflow I manually cloned them over to the requisite locations.

I do have a question, would you mind if I hosted the Linux builds or would you like a copy of the binaries?

Taikakim commented 1 year ago

I'm interested in the binaries! :)

KottV commented 1 year ago

I'm interested in the binaries! :)

what is your distro? I packaged ddsp for opensuse tw https://build.opensuse.org/package/show/multimedia:proaudio/ddsp

tank-trax commented 1 year ago

@Taikakim for Linux Debian 11 available here

https://github.com/tank-trax/ddsp-vst/releases

also if you'd like me to submit a pull request... I also made changes to .gitmodules to bypass authentication request

cheers

Taikakim commented 1 year ago

Thanks for those! I've been busy so just now saw this!