Little trouble with nested includes
-
I'm trying to get Frugally Deep working as a node, which depends on:
- FunctionalPlus (single .h file)
- Eigen (hundreds of .h files)
- JSON (already in HISE but I think I still need to add it manually)
These are all header-only libraries, so they should work as src for third party nodes, right?
The current problem I have, is Fdeep is including
#include "fdeep/common.hpp"
And that file is including
#include <Eigen/Core>
Which returns
no such file or directory
, I assume because it's trying to include the whole folder.Would I have to write an include.h file and include every single header file in that folder? If there's a better way, I'd love to hear it because I reaaaaaaally don't want to do that...
I've got the libraries in both the src folder:
And in the fdeep subfolder:
So I don't think it can't find the files, any help is much appreciated
-
@iamlamprey Not 100% if it helps, but try adding the
ThirdParty/src
folder to the HeaderSearch Paths in the projucer project (check theDspNetwork/Binaries/AutogeneratedProject.jucer
first).This way it will be able to resolve all those
#include <xxx>
statements. -
Ok got a little bit further by adding the src path as an Additional Include Directory in VS but then ran into about 10000 syntax errors so I think I'll look for a different library...
-
@iamlamprey You may only need to solve one of those errors to fix them all ;)
-
@d-healey yes but Eigen is a very complex and heavyweight library so it‘s not the easiest task to include it.
-
Yeah there doesn't really seem to be an agreed upon convention for getting TF working in C++, some people are using numpy/eigen, some are making their own wrappers like Frugally Deep and cppflow...
@Christoph-Hart Can third party nodes support prebuilt static libraries? Or does it have to be the source code? I might just have to bite the bullet and remake my autoencoder in pytorch since using TF in C++ is just a mess
-
@iamlamprey Using Machine Learning models in C++ can be quite tricky but here's an open source project by CHOW-DSP that uses machine learning and juce to model a Klon Centaur pedal.
I believe it uses RT Neural which is meant for real-time audio, however, the process should be somewhat similar.
https://github.com/jatinchowdhury18/KlonCentaur
https://github.com/jatinchowdhury18/RTNeuralHopefully, this helps with getting the implementation working.
All the best!
-
@KimiA Legend! I'll take a look, thank you :)
-
Okay think I have Tensorflow and CPPFlow building thanks for your help everyone!
Once I figure everything out and make sure it works properly I'll write up a quick post about it, in case anyone else here wants to mess around with Autoencoders (or god forbid try getting a GAN training)
Now onto the real endgame... how does one print to the HISE console from inside a Node?
-
why are the simplest things so difficult for me
// Parameter Functions ------------------------------------------------------- template <int P> void setParameter(double v) { if (P == 0) { // This will be executed for MyParameter (see below) String s; s = "test"; jassertfalse; debugToConsole(hise::Processor::getProcessor(), s); } }
-
If you‘re creating a third party node you‘ll most likely end up debugging jn VS / Xcode directly so you can print and breakpoint directly in the IDE.
Just open the IDE project in the DSPNetwork/Binaries subfolder, it should have the target set to the HISE Standalone app that will launch when you start debugging the project.
-
@Christoph-Hart do I have to manually target HISE if this happens?
or just debug the HISE project instead?
-
@iamlamprey Yes, go to the Project properties and select the HISE x64 Debug.exe as Command:
If you then click on the Debug play button in VS it will launch HISE and as soon as you load a node from your DLL it will jump into the code and you can step through it and print stuff.
DBG("Funky");
is your friend here. -
@Christoph-Hart Got it, thank you :)
-
@Christoph-Hart What would be the best way to add JSON-loadability to a node? Is that a realistic ask or would I be better off trying to just make this a base processor instead of a node?
-
@iamlamprey there is no API for communication with Strings so that will be a bit tricky. What data do you want to communicate?
-
@Christoph-Hart Yeh that would explain the error.
I'm trying to load a tensorflow model, so the data would be both the model itself (layers & their hyperparameters) and the actual weights & bias of the network (the "trained" part). They're mostly doubles I think but there's some strings in there as well for the type of layer & activation functions
The goal is
audio sample -> [network] -> output, where [network] is a big ol bunch of matrix math that does all the blackbox stuff automatically
Not gonna lie I may have bit off more than i can chew here, I've been watching Cherno's C++ series and I'm starting to grasp some of it but man my brain hurts lol.
I think I'll have to just get familiar with the tensorflow C api, all these other libraries and dependencies seem to pile up errors, and I really only need a few pieces of tensorflow (conv1d, leakyrelu, layernorm etc)
-
@iamlamprey Do you need to load different JSON files on runtime or can you include them in the C++ source?
-
@Christoph-Hart Ideally different ones at runtime (loading different models), but I could probably get away with including all of the models, then just use a node Parameter to switch between them and hide that parameter from the end user
worst case scenario I can copy the weight values manually into a struct or something and write my own activations (those are pretty simple), then the only part left really is re-creating the convolution layer, which is probably the hardest part
-
Here's an example of a "trained" model (it's not actually trained, the weights just get randomized on initialization) if it helps explain it better