faust
faust copied to clipboard
Unity Export Issues
I have tried various options to export a unity plugin and the resulting compiled native audio plugin binary is missing.
tried using FaustLive 2.46 on OSX prebuilt binaries, FaustPlayground and Faust online editor and the flute example .dsp file
using options for Platform:unity / osx results in a zip file expanding to three folders, here is the zip file:
flute_unity_osx.zip
one folder contains two C# scripts that work great and a README file explaining how to use unity2faust and the files it should produce from a source .dsp file, which describe it as resulting in a ready to use ".unityasset" one folder with a flute.cpp and one folder with a subfolder x64 that is empty (my guess is that this is where the binary would be?)
upon loading the folder and attaching to a simple gameObject cube and hitting play I get the following error: DllNotFoundException: libFaustPlugin_flute FaustUtilities_flute.Faust_Context..ctor (Int32 buffersize) (at Assets/FAUST/flute_unity_osx/FaustPlugin_flute/FaustUtilities_flute.cs:290) FaustPlugin_flute.Awake () (at Assets/FAUST/flute_unity_osx/FaustPlugin_flute/FaustPlugin_flute.cs:56)
it appears that the editor GUI generator works great, and the controls are all there, but the build is missing.
-- I also tried the the Playground and export to unity/ios which results in the foillowing zip file: Flute_Playground_iOS.zip
this contains 4 folders with random characters for names including text files named asset and pathname, one of the files named asset does appear to be a binary, the others are the .cs scripts and the README from faust2unity
-- also tried the unity / source export which creates a .dsp and cpp file, here is the zip: Flute_Playground_Source.zip
After investigation, the problem with unity/ios seems to be due to the way the mac decompresses an archive when you double-click it. The binary.zip file contains an .unitypackage file which is itself a compressed folder. When you double click on binary.zip the Mac will also decompress the unity package and you see the internals of the unity package. One solution is to use 'unzip binary.zip' with the command line to avoid this double decompression. A second problem is a missing option when compiling unity package for osx. This will be corrected this afternoon.
Sweet, looks like that worked great, great work :D A possible way to prevent that expansion issue, maybe the compiler could skip the .zip stage and the download could link directly to the .unityasset? I have downloaded .unityasset bundles on various github repos and the unity asset store and haven't had any issues.
@orlarey I explored a few exported unityassets and I have a feature request for the nature of the C# control scripts that are generated.
I found that in the current generated scripts, the controls can not be accessed directly and intuitively from their names in the list of controls for the game object as would be expected.
The current method requires calling a setParameter( index, value). Thus it requires the setup of another script or group of controls with an abstracted system that takes longer to implement and gets complicated to keep track if there are more sound objects in a scene.
I propose the generated scripts also create public variables in the control class using the range attribute. PD/Heavy is also a potentially good reference, their method appears to work directly. I will try to post an example and more info. Here is a folder from a Heavy test unity project that I did https://drive.google.com/open?id=1gfX7tMEt7gEL1wLKD_qN23sgK7xcY4s4
and their site page on how the unity control works : https://enzienaudio.com/docs/index.html#06.unity
Yes, It would help if you could "manually" generate the expected C# , starting from a given simple Faust generated unity assets, and hacking what has to be adapted.
Ok, I'll try to get that to you soon. One thing I noticed, there was a long string that defines all the control names for the unity editor in a separate script. I think this could likely be heavily simplified depending on the nature of the compiled binary. Is there any other faust2unity documentation beyond the readme that I could reference?
does my prior notion of skipping the .zip stage of the online complier and instead linking the download to a '.unityasset' file in order to avoid the OSX unzip issue make sense?
Hmm, circling back to some of this now. I was just noticing there was no longer an option in the online compiler for unity / OSX, it just has windows and source. Is osx support for unity export removed currently?
I remember we had problems cross-compiling for iOS/OSX. But you can still compile the DSP in a terminal with faust2unity.
Oh ok, thank you, I suppose you can disregard my other issue I posted today about this, Thought it would be nice to have in the online compiler.. soooo convenient. I also may end up doing everything through JUCE for the final, but super nice for rapid prototyping to have the web compiler.
I will also circle back now that I know more about unity I can likely help with improving the expected script
@sletz I wasn't sure if you had possibly missed my proposed solution for the osx unity package online download - A possible way to prevent that expansion issue, maybe the compiler could skip the .zip stage and the download could link directly to the .unityasset? I have downloaded .unityasset bundles on various github repos and the unity asset store and haven't had any issues.
@orlarey can we fix that on our side?
I remember we had problems cross-compiling for iOS/OSX. But you can still compile the DSP in a terminal with
faust2unity.
@sletz Firstly thank you for all the contribiutions! I am only just starting my jurney with coding coming from audio background. Would you ( or anyone else @orlarey , @MacroMachines ) be able to elaborate on how to get a .unitypackage file when exporting from IDE? there doesn't seem to be an option for OSX export, when unziping unity / linux binary with terminal The files I am getting are:
FaustPlugin_simpleSynth.cs FaustUtilities_simpleSynth.cs README.md simpleSynth.cpp simpleSynth.dsp
So I get stuck when following simple tutorial using .unitypackage like so: https://www.youtube.com/watch?v=nfs0yhr3l1c
One thing would be to make sure I am using corect binary for unity / osx I guess , other to get .unitypackage file.
Any pointers would be much appresiated. It seems like very exiting route to get into procedual audio in unity if I could only get it to work. Faust itself is very intuitive even for someone with no real coding experience!
Tkank you!
Are you on maxOS ? If yes using them 2.30.5 binary release and using the faust2unity tool in a terminal would be the easiest way.
@sletz thank you! I did try but keep getting errors probably due to my very limited knowlege about code in general. I'll have a go with a friend who's a developer before I bother you ;)