grame-cncm / faust

Functional programming language for signal processing and sound synthesis
http://faust.grame.fr
Other
2.58k stars 322 forks source link

faust2nodejs with -soundfile flag produces a directory of *.cpp / *. files instead of a *.node file #449

Closed dxinteractive closed 4 years ago

dxinteractive commented 4 years ago

I have FAUST Version 2.14.4 on macOS High Sierra 10.13.6 I have soundtest.dsp with the following contents:

import("stdfaust.lib");
process = os.osc(440);

It does not actually use soundfile yet, but I intend to add this later.

faust2nodejs -help says that -soundfile should work as it is "inherited directly from faust2api".

Thanks

dxinteractive commented 4 years ago

Ok, I partially solved this.

faust2nodejs is based on faust2api, so I tried faust2api directly. Unlike faust2nodejs, it displayed errors when it failed to build.

faust2api -coreaudio soundtest.dsp

Your dsp-faust.zip API package for CoreAudio is being created
/Users/damienclarke/faust/Faust-2.14.4/bin/faust2api: line 380: pkg-config: command not found
env: python2: No such file or directory

I installed pkg-config using brew install pkg-config, tried again, and the error progressed to this:

Your dsp-faust.zip API package for CoreAudio is being created
Package sndfile was not found in the pkg-config search path.
Perhaps you should add the directory containing `sndfile.pc'
to the PKG_CONFIG_PATH environment variable
No package 'sndfile' found
env: python2: No such file or directory

I installed libsndfile by running brew install libsndfile, and it appeared to create the intended zip file, although with a few warnings*:

Your dsp-faust.zip API package for CoreAudio is being created
ld: warning: directory not found for option '-L/usr/local/Cellar/flac/1.3.2/lib'
ld: warning: directory not found for option '-L/usr/local/Cellar/libogg/1.3.2/lib'
ld: warning: directory not found for option '-L/usr/local/Cellar/libvorbis/1.3.5_1/lib'
env: python2: No such file or directory

(*It seems these same warnings pop up in #192 and #364, but I cannot yet determine if they actually matter)

I didn't try to see if the contents of the zip file worked as I haven;t set my machine up for cpp development. Ignoring those warnings for now, I tried faust2nodejs -coreaudio -soundfile soundtest.dsp and it worked this time. Still haven't tried using soundfile in the dsp yet.

I guess the focus of this issue could now be on the second original point - Is it normal that the process should not produce any terminal output when something like this hasn't worked correctly?

dxinteractive commented 4 years ago

Have tried using soundfile now with the following dsp script:

import("stdfaust.lib");
process = 0,_~+(1):soundfile("son[url:{'A4.ogg'}]",2):!,!,_,_;

And this works! Running the *.node file produced by faust2nodejs -coreaudio -soundfile soundtest.dsp plays the sound A4.ogg.

sletz commented 4 years ago

faust2nodejs has a -debug option. Have you tried it to see if it properly display error messages in case of failure?

dxinteractive commented 4 years ago

Hi sletz, I'll reproduce the original situation and give that a go, thanks.

Keep up the great work with Faust by the way, I'm very impressed by it.

dxinteractive commented 4 years ago

Hi, haven't got around to this and likely wont for a while, feel free to close.