C++ to Gen~
Hello, I found a very nice project on Github (https://github.com/VCVRack/Rack) and wonder if it's very difficult to port it on Gen~. it could be really nice to have some of this Mutable Instruments in Beap…
Does somebody could take a look at this ? Or give some clue to begin…
Sometimes porting C code to genexpr is pretty easy -- there's only a handful of gotchas in the differences of the language. But sometimes it is much trickier, if the original code uses constructs that are more difficult to replicate in gen (e.g. arrays of structs). And some parts may need to be in Max, e.g. if there's buffer loading, MIDI, preset loading, etc.
That repo has a lot of code in it -- and it looks like a lot of that is application level. Isn't that repo an entire DAW? Looks to me like the port of the MutableInstruments you mention are in this repo: https://github.com/VCVRack/AudibleInstruments
Note that the original MutableInstruments (https://mutable-instruments.net) are covered by cc-by-sa 3.0 license, so anything derived from it would also need to honor those terms. https://creativecommons.org/licenses/by-sa/3.0/ More discussion about what VCV is doing here:
https://forum.mutable-instruments.net/t/vcv-and-moral-conflict/12901
Based on that I'd recommend you contact the Mutable Instruments community first to get the go ahead. Other than that, the actual instruments vary in complexity, some look pretty straightforward to gen-ify, others may be much trickier (e.g. Clouds).
Olivier' code is a really wonderful gift to the community and worth the dive. You rarely get to see a full example of production code.
One thing to note is that Olivier's code was designed to run at specific sample rates, so things may sound a little different in VCV if the samplerate is lower than the module's original sample rate. Any filters in the code with static, hard-coded coefficients would need to be recomp because they would be off in terms of frequency response. (e.g. 500 Hz occurs at a different angle on the unit circle for 44100 and 96000)
Hey folks, I thought I would ping this thread again since it has been a while. I am also very interested in porting over VCV Rack modules to ~gen and MaxforLive.
I was wondering has anyone been able to take an example VCV Rack and port it to Max? I would love to help contribute to such an effort
As noted above, there's been interest popping up a few times to port some of Emilie's kindly shared code from the Mutable Instruments into gen~ (or RNBO). I think that would be a lovely community project, a good learning process, and an opportunity to take it somewhere new (which I understand was Emilie's intent in open sourcing in the first place.) BTW the original code is at https://github.com/pichenettes/eurorack -- the VCV modules (https://github.com/VCVRack/AudibleInstruments) are wrappers around that. Also, as Peter noted above, the original code was written for an AVR microcontroller and will have some elements of it that are kind of unique to it that would not really be necessary for a gen~/RNBO port -- stripping those limits away would be one of the things I'd recommend.
More generally, porting code from something like the VCV might have some advantages in terms of a recognizable template to start from, but the more general problem of converting C++ into gen~ (or RNBO) is probably going to be a manual process each time, and there's going to be some things that are quite hard to translate. There's also going to be things that will be easier to express in simple ways in gen~/RNBO than in C++, and doing that would be a contribution, as it should hopefully open up new ideas of where things can go.
I guess what I'm saying is, a direct port wouldn't be a walk in the park, but doing it well could be well worth it. Definitely think this would be a fun community project!
(Noting for future web searchers on VCV + gen~/RNBO: there's already pipelines going the other way, from gen~ to VCV: https://github.com/isabelgk/gen-rack and from RNBO to VCV: https://rnbo.cycling74.com/explore/vcv-rack-starter. Also I know there's also some VCV modules that have been built from or inspired by gen~ patchers, including some of these: https://library.vcvrack.com/HetrickCV)
Hi Anthony, is the goal just to be able to use outside C/C++ code in Max? A roundabout solution that I have been exploring and plan to write some tutorial material on later is doing so through Csound. The reason being that adding C code to Csound as a plugin opcode is much simpler than writing a Max DSP external, and would (possibly) be much simpler than porting to Gen patching or Gen codebox.
And then using them in Max is simple, and is really not much different from Gen (you have a box, it runs some code, otherwise it's like a Max object).
Just a thought!