Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@grame/libfaust: .compileNode() doesn't return details about syntax errors #756

Open
dxinteractive opened this issue Jun 29, 2022 · 0 comments

Comments

@dxinteractive
Copy link

dxinteractive commented Jun 29, 2022

While making my own version of Faust IDE, I'm finding it a little difficult to use Faust.createMonoFactory().compileNode() when given incorrect dsp, because the specific details about the syntax error don't seem to be available anywhere. All that I see is that console.error is called stating that a syntax error occurred, and the result of the promise returned from .compileNode() is null.

image

My code:

const dsp = `
import("stdfaust.lib");
process = os.sawtooth(1000.0), os.sawtooth(200.0.0);
`;

const compiler = Faust.createCompiler(Faust.createLibFaust(module));
const node = await Faust.createMonoFactory().compileNode(
  audioCtx,
  "Faust",
  compiler,
  dsp,
  "-ftz 2",
  false,
  128
);

Would it be worth considering this?
a) surfacing the details of the syntax error through the API
a) If compilation fails, it might be more idiomatic javascript and more useful for developer if the promise returned from .compileNode() rejects with an Error containing those error details. Simply receiving null gives no information about what went wrong.

Or is there a way I don't know about? I'm looking into compilation parameters that might affect this.

The Faust IDE for example shows a more specific error "unexpected float":

import("stdfaust.lib");
process = os.sawtooth(1000.0), os.sawtooth(200.0.0);

yields

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant