GATech-CSE-6730-Spring-2023-Project / mesh2audio

Convert meshes into physical audio models and play them by striking mesh vertices in a 3D viewer.
GNU General Public License v3.0
11 stars 0 forks source link

Build step: ./script/Build #1

Closed FinishedBz1 closed 1 year ago

FinishedBz1 commented 1 year ago

Hi I am Alwin (the guy from the YouTube comments). So I am stuck at the ./script/Build command. That's the output: -- The C compiler identification is unknown -- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:9 (project): The CMAKE_C_COMPILER:

clang

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

CMake Error at CMakeLists.txt:9 (project): The CMAKE_CXX_COMPILER:

clang++

is not a full path and was not found in the PATH.

Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH.

-- Configuring incomplete, errors occurred! See also "/home/finishedbz/.ssh/mesh2audio/app/build/CMakeFiles/CMakeOutput.log". See also "/home/finishedbz/.ssh/mesh2audio/app/build/CMakeFiles/CMakeError.log". gmake: Makefile: No such file or directory gmake: *** No rule to make target 'Makefile'. Stop.

I would appreciate your help with those errors :)

khiner commented 1 year ago

Hi Alwin, thanks for the details here.

I've made a couple changes (unrelated to your issue) - before anything else, please run a git pull.

I just fired up my Ubuntu machine to try and build this again, and I'm getting new issues, but much further down the line, which I'll be working on fixing today. Let's get you past your issue and see how far it gets you. The problem you're running into is that your clang compiler is not in your system's path. Did you run the following from the readme?

$ sudo apt install llvm libeigen3-dev
$ export PATH="$PATH:$(llvm-config-15 --bindir)"
$ sudo apt-get install libc++-dev libc++abi-dev

That export PATH line is what you need. That will only change your path for the active session in that terminal window, so if you ran that and opened a new session, that could also cause the issue.

If that doesn't work, could you please post the output of running:

$ llvm-config-15 --bindir

Thanks! Hopefully this gets you further along.

FinishedBz1 commented 1 year ago

Command: $ llvm-config-15 --bindir Output: /usr/lib/llvm-15/bin I did run those lines before. Now I did it surely in the same session and it shows the same problems again.

I wonder if need to install clang? I did it I believe but it doesn't seem to make a difference. I ran git pull after $ cd mesh2audio/app

khiner commented 1 year ago

Ok I think I see the issue. TL;DR: Please do a fresh git pull and run:

$ sudo apt install llvm clang lldb lld libc++-dev libc++abi-dev libeigen3-dev
$ ln -s llvm-config-15 llvm-config
$ export PATH="$(llvm-config --bindir):$PATH"

Before you try building again, please verify the following output paths:

$ which llvm-config
$ which clang
$ which clang++
$ which lld

Only try rebuilding if those output actual file paths.

Longer story:

I pushed up a change to not even specify the clang compiler in the CMakeLists.txt, since the build script already passes the CC and CXX flags it needs. I also updated the instructions to put the newly installed binary directory of llvm before any clang that might be in your system path. Please try pulling the git repo again, then try running export PATH="$(llvm-config-15 --bindir):$PATH" (note $(llvm-config-15 --bindir) before $PATH.

I also updated the instructions to install clang, lldb, and lld separately. Even though they are installed with llvm, they all have -{version-number} appended to their binaries, e.g. clang-15. The command ln -s llvm-config-15 llvm-config will alias the llvm-config command to reference your llvm-config-15, which you have confirmed you have. That should make llvm findable.

(Aside: In that directory (/usr/lib/llvm-15/bin), there should be executables clang++-15, clang-15, etc. They aren't being found on your system because of the version numbers in the file names. However, instead of using those binaries, we'll only make an alias for llvm-config for the actual llvm requirement, and do separate installs of clang and lld.)

FinishedBz1 commented 1 year ago

It seems to have solved most of the problems since it is building it after all. But in the end there is not a ./mesh2audio file in build or build-release.

Maybe I just made many changes since I tried quite often to install it and the paths don't match anymore.

Those are the errors: Command: ./script/Build Output: [ 96%] Built target dynamiclib gmake[1]: [CMakeFiles/Makefile2:291: CMakeFiles/mesh2audio.dir/rule] Error 2 gmake: [Makefile:190: mesh2audio] Error 2

Command: ./script/Build -r [--release] Output: [ 96%] Built target dynamiclib gmake[1]: [CMakeFiles/Makefile2:291: CMakeFiles/mesh2audio.dir/rule] Error 2 gmake: [Makefile:190: mesh2audio] Error 2

It breaks down at 96% apparently. In case you do not have a solution I could try installing a fresh ubuntu and do everything right from the start.

khiner commented 1 year ago

Progress! Ok I messed with this for awhile and had a tough time using clang and its stdlib & loader on Ubuntu... then I just tried using the system g++ compiler, and it "worked" after fixing an issue in the code. On my Ubuntu machine, it now successfully builds the mesh2audio executable in the build/ directory. If I cd build/ and ./mesh2audio, it fails with the expected Error initializing glew. Can you please run

$ git pull
$ git submodule update --init --recursive
$ cd app
$ ./script/Clean
$ ./script/Build

and confirm that you are able to build the executable now at least? I'll be working on the glew (OpenGL) issue on my end, but there's a chance it may "just work" for you depending on your system 🤞

Sorry for all the back and forth on this and thanks for your patience!

FinishedBz1 commented 1 year ago

It has build the executable successfully! But it does not open because of the expected error. (Error initializing glew)

Thank you for helping me at all. To me this is the most valuable piece of software you are giving to me. As I said I always wanted to have a synth in which I can literally create the sounds I imagine. It's a miracle that someone dealt with assembling all of the available knowledge into an interface that I can use. I don't know much about physical modelling. I'm just a high school student from Berlin. Before it I tried to emulate those sort of sounds using frequency modulation combined with a series of comb filters.

If I manage to set up mesh2audio it's going to elevate my workflow to the next level. The axisymmetric geometry is so smart as opposed to creating models in blender every time. Just perfect for creating instruments and impulse responses.

khiner commented 1 year ago

Great! I hope we can get it working for you and that it helps with your workflow.

I just pushed up another change and it now builds and runs successfully on my Ubuntu machine. (Basically just ignoring this glew error which seems to be a false alarm 🤷‍♂️)

Please try to git pull and ./script/Build again (no need to clean-build) 🤞

FinishedBz1 commented 1 year ago

Good news: it runs Bad news:

  1. There is no sound output. Maybe I need to install an audio driver since I have only set up Ubuntu without dealing with it.

After generating the tetrahedral mesh and a 3D DSP the audio device window shows "ERROR : unable to open file stdfaust.lib"

  1. If I click on generate axisymmetric DSP (that sounded better in the video) the program just closes.
khiner commented 1 year ago

Ok, getting there. Are you running the ./mesh2audio after changing directories into the build dir? The behavior you're describing could be caused by running from outside of that directory, like ./build/mesh2audio. Could you also check that app/lib/faust/libraries/stdfaust.lib exists? If that app/lib/faust/libraries directory is empty, it could be that in all the shuffle since faust includes it as a submodule.

FinishedBz1 commented 1 year ago

$ cd app/lib/faust/libraries/stdfaust.lib bash: cd: app/lib/faust/libraries/stdfaust.lib: No such file or directory

That's how I am running it: ~/mesh2audio/app/build$ ./mesh2audio

khiner commented 1 year ago

Ok that would do it - just to be clear - cd is the command to move to a directory, and stdfaust.lib is a file, not a directory. We want to know if ~/mesh2audio/app/lib/faust/libraries is empty, so you can do ls ~/mesh2audio/app/lib/faust/libraries with the full path. If it is indeed empty, that would cause this issue. If it's empty, please try git submodule update --init --recursive --remote lib/faust from the ~/mesh2audio/app directory, and try running again.

FinishedBz1 commented 1 year ago

$ ls ~/mesh2audio/app/lib/faust/libraries aanl.lib fds.lib old soundfiles.lib all.lib filters.lib oscillators.lib spats.lib analyzers.lib hoa.lib phaflangers.lib stdfaust.lib basics.lib install physmodels.lib synths.lib compressors.lib instruments.lib platform.lib tonestacks.lib delays.lib interpolators.lib quantizers.lib tubes.lib demos.lib licenses README.md vaeffects.lib doc maths.lib reducemaps.lib version.lib docs maxmsp.lib resources wdmodels.lib dx7.lib mi.lib reverbs.lib webaudio.lib dx7presets misceffects.lib routes.lib embedded modalmodels sf.lib envelopes.lib noises.lib signals.lib

It's not empty AND THE FILE DOES EXIST

FinishedBz1 commented 1 year ago

sh: 1: ./../../fem/fem: Exec format error terminate called after throwing an instance of 'std::runtime_error' what(): Error executing fem command. Aborted (core dumped)

Thats the errors it shows when I run it from the terminal.

FinishedBz1 commented 1 year ago

Also, in the control section there are no sliders. I am not sure if I recall it right but I feel like it was there when I started it the first time.

FinishedBz1 commented 1 year ago

stdfaust.lib does exist.

khiner commented 1 year ago

Alright, this is hopefully fixed if you do a fresh pull, build, and run.

FinishedBz1 commented 1 year ago

The sound and control problem is fixed. When I generate the axisymmetric DSP the application still closes. The same thing happens when I load in more complex meshes. The moment I press "Generate tetrahedral mesh" it closes.

Those must be performance related issues. The specs of my computer should be good enough though.

I also wonder how you modify the 2d images because it does not seem to have a way to add or delete points. Being able to draw own shapes would be convenient.

But I see how I can use the existing points to design unique 2d shapes now.

khiner commented 1 year ago

Great! Does "Generate tetrahedral mesh" crash the program when it's the first thing you do after starting the app? I ask because it's possible generating tetrahedral meshes can fail (in some rare circumstances) after messing with the 2D profile.

From here on you should make release builds for performance reasons - simply use ./script/Build -r (add the -r flag). This will make it run a good deal faster, but with somewhat longer build times.

What error messages do you see in the console after it shuts down after axisymmetric DSP generation, and with tetrahedral mesh generation? (I assume the former is still ./../../fem/fem: Exec format error ?)

The program currently only supports moving existing control points, not adding new points. You can get some additional control over the shape by enabling control over control points instead of just anchor points by enabling the checkbox in |Mesh controls|->|Mesh profile|->|Control points| (at the bottom).

khiner commented 1 year ago

Ah I can reproduce the "Exec format error" on Linux. I'll work on that next. Still curious about the crash log message when you get it to crash during tetrahedral mesh generation.

FinishedBz1 commented 1 year ago

"Generate tetrahedral mesh" works just fine with the bell for instance. But if I import the teddy for instance it crashes when creating mesh is the first thing I do. Sometimes it does not load the meshes graphically.

The 2d stuff it good enough for me though. I have just heavily modified the bell. It took forever to generate the mesh so I closed the program.

That's the "Generate tetrahedral mesh" crash: WARNING: adding duplicated poly! WARNING: adding duplicated poly! load mesh 1292V / 3756E / 2464P [0.0425633s] load normals Delaunizing vertices... Exception: All vertices are (nearly) collinear (Tol = 1e-08). terminate called after throwing an instance of 'int' Aborted (core dumped)

FinishedBz1 commented 1 year ago

That's the "axis symmetric DSP" crash: sh: 1: ./../../fem/fem: Exec format error terminate called after throwing an instance of 'std::runtime_error' what(): Error executing fem command. Aborted (core dumped)

FinishedBz1 commented 1 year ago

./script/Build -r after the issues into mesh2audio/app ?

khiner commented 1 year ago

Generate tetrahedral mesh" works just fine with the bell for instance. But if I import the teddy for instance it crashes.

Got it, this is expected. Many triangular meshes just don't lend themselves well to generating a 3D volumetric mesh without more repair work done. There are requirements for the topology of the triangular mesh. I'm using tetgen, so you can consult their documentation for more details on that front.

I just heavily modified the bell. It took forever to generate the mesh.

Glad you're able to modify the profile & mesh. As I mentioned, building a release build should help a good deal, but some shapes will just take a long time. If you're willing to sacrifice some fidelity, disabling "Quality mode" under "Mesh settings" should help a lot by reducing the granularity of the tet mesh. You can also experiment with the "Resolution" settings under "Mesh profile", to make the 3D rotated shape less detailed.

sh: 1: ./../../fem/fem: Exec format error

I can reproduce this as well. This is because the fem command is a Fortran library that's pre-built with a script and committed to the repo as a full binary executable. It only runs on the platform it was built on. I will work on incorporating the Fortran lib build into the larger CMake project so it builds along with the application.

/script/Build -r after the issues into mesh2audio/app ?

Yes if you just run ./script/Build -r instead of /script/Build like you have been, it will create a build in build-release/ (right next to your build/ directory).

FinishedBz1 commented 1 year ago

Well thank you. I appreciate your help! I am experimenting right now.

I will let you know if I encounter any problems. If I create something nice I can write you an email.

khiner commented 1 year ago

Actually @FinishedBz1, you could fix this for yourself much faster than I could get the fem program incorporated into the build and update you with instructions - Could you please run:

$ cd ~/mesh2audio/fem
$ sudo apt install gfortran
$ ./build.sh

(I just added these instructions to the readme as well.)

That's it - if this is successful, you don't need to re-build the application. Just run again and try generating the Axisymmetric DSP again.

Well thank you. I appreciate your help!

No problem, I'm glad it's working for you!

I will let you know if I encounter any problems. If I create something nice I can write you an email.

Please do, and I would love to hear about anything you end up making with it!

FinishedBz1 commented 1 year ago

Did not expect this comeback.

Amazing, it works. For some reason it sounds substantially better.

khiner commented 1 year ago

Great :) I also find that the final results across many different shapes, material settings, and DSP parameters can sound a bit samey. One fun thing to try is loading the rect.svg and pulling the bottom middle down to make a curved bottom and flat top, and generating a 3D tet / DSP. That's how I got the "hand drum" sound in the audio samples. It still has similar character, but the flat sides, corners, and round parts all respond differently to impulses, and I like the sound. Also try the wine glass svg with glass material, and reducing the overall decay time and playing with other parameters. Anyway, have fun!

FinishedBz1 commented 1 year ago

how do I add svg. s ?

khiner commented 1 year ago

You can load an SVG from anywhere on your system with File->Load mesh, and just select an SVG instead of a .obj file.

FinishedBz1 commented 1 year ago

When I try to open images with load mesh the svg. folder is empty. But its not actually empty

khiner commented 1 year ago

I can reproduce this on Linux as well (works fine on mac). Must be the native Ubuntu file explorer not handling multiple extensions in the filter. Looking into this...

khiner commented 1 year ago

I see, this is just a Ubuntu thing. Looks like it only allows filtering to one file type at a time. In the lower-right of your file explorer, you should see a dropdown for the file type that defaults to "Mesh object (obj)". You can switch to view svgs.

FinishedBz1 commented 1 year ago

Solved.

I start to get more versatile sounds. You tend to get the impression that everything sounds same when you never change the pitch.

FinishedBz1 commented 1 year ago

Its actually quite cool. I am trying to get more rather tonal sounds. I like it when the decay is shorter.

khiner commented 1 year ago

Oh yeah pitch and decay both play a huge role there. A big missing piece in this project (also in the original mesh2faust) is to also find the damping matrix of the system and use it to calculate the decay times of each mode, which would help a lot with realism.

FinishedBz1 commented 1 year ago

I wonder how much there is to improve to be more creative with it.

The wine glass is my favorite so far because it sounds quite tonal and unique with lower frequencies.

Ill definitely find use for it.

FinishedBz1 commented 1 year ago

Are there wys to play around with mesh2faust. Just to experience whats possible in terms of physical modelling with meshes?

FinishedBz1 commented 1 year ago

Generally very strong work. A practical improvement would be having it work as a plugin in a daw with midi support.

I am not sure how seriously you take further developing that plugin but you could definitely fill a void for music producers and musicians improving it.

Its crazy that your code it not a popular tool on the internet yet. I think many producers could use it to synthesize instruments.

I can also imagine using it as impulse response for frequency modulated sounds to make them sound more unique.

FinishedBz1 commented 1 year ago

Now I see how I can make unique sounds. Exactly what I wanted.

Apparently more regular shapes make more tonal sounds.

I made a pole with the rectangle. Its almost a sine wave. I would be cool if there was a way to make a pipe or a tube without an ending.

khiner commented 1 year ago

Are there wys to play around with mesh2faust

I might be misunderstanding the question, but this whole program is pretty much a wrapper around mesh2faust with some improvements, providing as much interface and tweakability as I had time for during the project. There are still some things that aren't exposed, however, like adapting the number of estimated frequency modes.

Generally very strong work.

Thank you! I'm really happy with the way the project turned out.

I am not sure how seriously you take further developing that plugin but you could definitely fill a void for music producers and musicians improving it.

I appreciate that and I totally agree. I would love to see more tools like this in the wild, and I'm also unaware of anything with the same kind of feature set. I probably will keep this project mostly as-is, not adding new features and just doing bug fixes if folks end up finding it and using it. But I am motivated to push this kind of work further to support plugin design, midi, hardware interfaces etc. I have a longer-term project that I need to stress does not do much of interest yet over here: https://github.com/khiner/flowgrid/ - that's where I'll be continuing to develop these ideas further, and will likely integrate this project as a component of that one. Again - not for public consumption yet, and it's mostly boilerplate for a framework so far.

Its crazy that your code it not a popular tool on the internet yet. I think many producers could use it to synthesize instruments.

Appreciated :) It was a school project and was only posted outside of school as a video on my youtube and on the Faust discord. I'm curious how you found out about this project? Was it through the Powered by Faust list?

I can also imagine using it as impulse response for frequency modulated sounds to make them sound more unique.

It was a stretch goal to support using microphone input instead of a simple gate to resonate the excitation vertices. If it would be of use, I may add that (also for my own curiosity!) since it shouldn't be much more work.

Exactly what I wanted.

Glad to hear it's working out!

I would be cool if there was a way to make a pipe or a tube without an ending.

I experimented with this and found that topologies with holes tended to produce errors during mesh generation. It would be a good thing to support.

FinishedBz1 commented 1 year ago

Appreciated :) It was a school project and was only posted outside of school as a video on my youtube and on the Faust discord. I'm curious how you found out about this project? Was it through the Powered by Faust list?

Exactly.

It was a stretch goal to support using microphone input instead of a simple gate to resonate the excitation vertices. If it would be of use, I may add that (also for my own curiosity!) since it shouldn't be much more work.

I wouldn't add that feature. I could just imagine recording sounds and running them through a convolution reverb.

FinishedBz1 commented 1 year ago

I might be misunderstanding the question, but this whole program is pretty much a wrapper around mesh2faust with some improvements, providing as much interface and tweakability as I had time for during the project. There are still some things that aren't exposed, however, like adapting the number of estimated frequency modes.

I just cared about generating sounds as versatile as possible. That's why id like to improve it to its whole potential.

I am not a developer. But I am probably going to study computer science. Do you think a programmer who understands the languages could conceive what you did and continue on developing?

Its just really valuable. Couldn't even buy it because nobody developed it. It's precious.

khiner commented 1 year ago

I tried again with a very simple mesh with a whole (there's a hidden "Close path" toggle that I don't even show since it crashes tet mesh generation):

Screenshot 2023-05-08 at 3 13 11 PM

Confirmed that even really simple cylinder shapes like this break the tetgen library, which convinces me more it just doesn't support topologies with a hole. Although maybe there's a way to configure it. However, axisymmetric generation works!

khiner commented 1 year ago

If you want to try you can just uncomment this line: https://github.com/GATech-CSE-6730-Spring-2023-Project/mesh2audio/blob/main/app/src/MeshProfile.cpp#L300

    // modified |= Checkbox("Close path", &ClosePath); // Leaving holes doesn't work well with tetgen.
FinishedBz1 commented 1 year ago

And how do I compile that change?

khiner commented 1 year ago

I might be misunderstanding the question, but this whole program is pretty much a wrapper around mesh2faust with some improvements, providing as much interface and tweakability as I had time for during the project. There are still some things that aren't exposed, however, like adapting the number of estimated frequency modes.

I just cared about generating sounds as versatile as possible. That's why id like to improve it to its whole potential.

I am not a developer. But I am probably going to study computer science. Do you think a programmer who understands the languages could conceive what you did and continue on developing?

Its just really valuable. Couldn't even buy it because nobody developed it. It's precious.

That's great! For me, computer science just keeps getting more fascinating the more I learn, and I encourage you to pursue it if you're interested! I think most of the code here is easy enough to understand, as far as these things go, but it's probably a little complex as a place to start. There is no better way to learn than building the fun things you want to see in the world - feel free to take anything from here you'd like and run with it (provided you keep the source open as per the GPL license)!

And how do I compile that change?

You can just make the change and run ./script/Build -r again.

FinishedBz1 commented 1 year ago

Seems to work thanks.

FinishedBz1 commented 1 year ago

image That sounds nice: https://drive.google.com/file/d/1Tzn_rS1hdzAqdTf4omvFtlQtvf7eCydR/view?usp=sharing Glad, I asked about pipes.

khiner commented 1 year ago

Love it! Interesting harmonics, those tube shapes really do bring out a different character

FinishedBz1 commented 1 year ago

Another thing that I find very useful and might be not as difficult to add: You can already change the hammer hardness.

It would be nice if I could extend the values of the slider somewhere in the code so the white noise exciter has a sustained character. It would sound as if you bow the object.

Since I want to use it as an instrument it was cool if I could sample longer sounds too.