HISE Logo Forum
    • Categories
    • Register
    • Login

    Error message with FAUST in HISE

    Scheduled Pinned Locked Moved Faust Development
    15 Posts 4 Posters 726 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • toxonicT
      toxonic
      last edited by toxonic

      hi folks,
      i enabled faust in the current hise release according to the build instructions mentioned in this Thread.
      I tried to build a simple gain button:

      // Faust Source File: gain
      // Created with HISE on 2022-10-12
      import("stdfaust.lib");
      gain = vslider("gain", 0, 0,1,0.01);
      process = *( _,gain),*(_,gain);
      

      Because the vslider wasn't smoothed out, it sounded crackling when tweaking the gain knob, so i wanted to smooth it out with "si.smoo", a standard function in faust for smoothing slider movements.

      // Faust Source File: gain
      // Created with HISE on 2022-10-12
      import("stdfaust.lib");
      gain = vslider("gain", 0, 0,1,0.01):si.smoo;
      process = *( _,gain),*(_,gain);
      

      this works fine in the faust IDE (faust works) but HISE gave me the following error message:

      Script FX1:! maths.lib : 133 : ERROR : syntax error, unexpected IDENT, expecting LPAR or DEF�
      

      i also tried different simple faust scripts i once made, always the same error.
      Doesn't it find the needed libraries? on Linux, faust is installed in "/usr/local", so i set that path in HISE preferences as faust path.
      Any ideas on that?

      Christoph HartC 1 Reply Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @toxonic
        last edited by

        @toxonic It compiles here just fine and I suspect it to be a library version mixup.

        The FaustPath setting must point exactly to the location where all the faust files are located (so the direct parent of include, lib and share). Also make sure that you're using an up to date Faust version (2.50 at the moment) there were a few changes in the last release that fixed the C++ compilation.

        1 Reply Last reply Reply Quote 0
        • toxonicT
          toxonic
          last edited by

          @Christoph-Hart mhhh... "/usr/local" contains the folders "include", "lib" and "share", so i guess, it should be the correct path to Faust, since it's the common installation folder for Faust on Linux systems, afaik. For example the "maths.lib" file is in "/usr/local/share/faust". Can you confirm, that it's the correct path for the HISE preferences?
          I have installed the most current version of faust, including the LLVM backend, which i also enabled for HISE.
          faust.png
          One more question: Are the following settings for the HISE-Standalone .jucer file correct ?
          Moduels.png Makefile.png

          1 Reply Last reply Reply Quote 0
          • toxonicT
            toxonic
            last edited by

            Maybe @sletz or @etXzat have an idea?

            1 Reply Last reply Reply Quote 0
            • S
              sletz
              last edited by sletz

              Can you compile the same code as a separated file in a terminal?

              toxonicT 1 Reply Last reply Reply Quote 0
              • toxonicT
                toxonic @sletz
                last edited by

                @sletz you mean in Faust? I already compiled it in Faust works, no problem there...

                S 1 Reply Last reply Reply Quote 0
                • S
                  sletz @toxonic
                  last edited by

                  @toxonic Not in Faust Web IDE, but in a terminal on your machine:

                  • you create a foo.dsp file with the code
                  • then "faust foo.dsp" in a terminal, does this works?
                  toxonicT 1 Reply Last reply Reply Quote 0
                  • toxonicT
                    toxonic @sletz
                    last edited by

                    @sletz i'll try, when i'm back home. But i'm pretty sure it works, since i didnt't mean the Faust online compiler, but the Faust works IDE on my machine, which compiles via the local Faust compiler.

                    S 1 Reply Last reply Reply Quote 0
                    • S
                      sletz @toxonic
                      last edited by

                      @toxonic The web Faust IDE embed its own webassembly version of the compiler and all DSP libraries. So running in a terminal is a different story.

                      Christoph HartC toxonicT 2 Replies Last reply Reply Quote 0
                      • Christoph HartC
                        Christoph Hart @sletz
                        last edited by

                        The example works on my Macbook too so I'm pretty sure it's something with your faust installation.

                        What happens if you install faust to a completely different location and then set the FaustPath to this directory?

                        toxonicT 1 Reply Last reply Reply Quote 0
                        • toxonicT
                          toxonic @sletz
                          last edited by

                          @sletz I usually use the Faust Works IDE, so I have no experience in using Faust via terminal.
                          I tried to compile the code to alsa-gtk app, and there is no problem:
                          faust_gtk.png
                          If i should use the terminal, could you please tell me, what to type in? 🤔
                          @Christoph-Hart I am not firm in installing software to other locations but the default ones. What have i got to do? "sudo make install /home/XYZ/faust"?

                          S 1 Reply Last reply Reply Quote 0
                          • S
                            sletz @toxonic
                            last edited by sletz

                            @toxonic You create a foo.dsp text file, you paste the DSP code. Then type "faust foo.dsp" in a terminal.

                            toxonicT 1 Reply Last reply Reply Quote 0
                            • toxonicT
                              toxonic @sletz
                              last edited by

                              @sletz It seems to compile properly to cpp code. This is the output:

                              toxonic@toxonic-studio:~/Schreibtisch$ faust gain.dsp
                              /* ------------------------------------------------------------
                              name: "gain"
                              Code generated with Faust 2.50.6 (https://faust.grame.fr)
                              Compilation options: -lang cpp -es 1 -mcd 16 -single -ftz 0
                              ------------------------------------------------------------ */
                              
                              #ifndef  __mydsp_H__
                              #define  __mydsp_H__
                              
                              #ifndef FAUSTFLOAT
                              #define FAUSTFLOAT float
                              #endif 
                              
                              #include <algorithm>
                              #include <cmath>
                              #include <cstdint>
                              #include <math.h>
                              
                              #ifndef FAUSTCLASS 
                              #define FAUSTCLASS mydsp
                              #endif
                              
                              #ifdef __APPLE__ 
                              #define exp10f __exp10f
                              #define exp10 __exp10
                              #endif
                              
                              #if defined(_WIN32)
                              #define RESTRICT __restrict
                              #else
                              #define RESTRICT __restrict__
                              #endif
                              
                              
                              class mydsp : public dsp {
                              	
                               private:
                              	
                              	int fSampleRate;
                              	float fConst0;
                              	float fConst1;
                              	FAUSTFLOAT fVslider0;
                              	float fRec0[2];
                              	
                               public:
                              	
                              	void metadata(Meta* m) { 
                              		m->declare("compile_options", "-lang cpp -es 1 -mcd 16 -single -ftz 0");
                              		m->declare("filename", "gain.dsp");
                              		m->declare("maths.lib/author", "GRAME");
                              		m->declare("maths.lib/copyright", "GRAME");
                              		m->declare("maths.lib/license", "LGPL with exception");
                              		m->declare("maths.lib/name", "Faust Math Library");
                              		m->declare("maths.lib/version", "2.5");
                              		m->declare("name", "gain");
                              		m->declare("platform.lib/name", "Generic Platform Library");
                              		m->declare("platform.lib/version", "0.2");
                              		m->declare("signals.lib/name", "Faust Signal Routing Library");
                              		m->declare("signals.lib/version", "0.3");
                              	}
                              
                              	virtual int getNumInputs() {
                              		return 2;
                              	}
                              	virtual int getNumOutputs() {
                              		return 2;
                              	}
                              	
                              	static void classInit(int sample_rate) {
                              	}
                              	
                              	virtual void instanceConstants(int sample_rate) {
                              		fSampleRate = sample_rate;
                              		fConst0 = 44.1f / std::min<float>(1.92e+05f, std::max<float>(1.0f, float(fSampleRate)));
                              		fConst1 = 1.0f - fConst0;
                              	}
                              	
                              	virtual void instanceResetUserInterface() {
                              		fVslider0 = FAUSTFLOAT(0.0f);
                              	}
                              	
                              	virtual void instanceClear() {
                              		for (int l0 = 0; l0 < 2; l0 = l0 + 1) {
                              			fRec0[l0] = 0.0f;
                              		}
                              	}
                              	
                              	virtual void init(int sample_rate) {
                              		classInit(sample_rate);
                              		instanceInit(sample_rate);
                              	}
                              	virtual void instanceInit(int sample_rate) {
                              		instanceConstants(sample_rate);
                              		instanceResetUserInterface();
                              		instanceClear();
                              	}
                              	
                              	virtual mydsp* clone() {
                              		return new mydsp();
                              	}
                              	
                              	virtual int getSampleRate() {
                              		return fSampleRate;
                              	}
                              	
                              	virtual void buildUserInterface(UI* ui_interface) {
                              		ui_interface->openVerticalBox("gain");
                              		ui_interface->addVerticalSlider("gain", &fVslider0, FAUSTFLOAT(0.0f), FAUSTFLOAT(0.0f), FAUSTFLOAT(1.0f), FAUSTFLOAT(0.01f));
                              		ui_interface->closeBox();
                              	}
                              	
                              	virtual void compute(int count, FAUSTFLOAT** RESTRICT inputs, FAUSTFLOAT** RESTRICT outputs) {
                              		FAUSTFLOAT* input0 = inputs[0];
                              		FAUSTFLOAT* input1 = inputs[1];
                              		FAUSTFLOAT* output0 = outputs[0];
                              		FAUSTFLOAT* output1 = outputs[1];
                              		float fSlow0 = fConst0 * float(fVslider0);
                              		for (int i0 = 0; i0 < count; i0 = i0 + 1) {
                              			fRec0[0] = fSlow0 + fConst1 * fRec0[1];
                              			output0[i0] = FAUSTFLOAT(float(input0[i0]) * fRec0[0]);
                              			output1[i0] = FAUSTFLOAT(float(input1[i0]) * fRec0[0]);
                              			fRec0[1] = fRec0[0];
                              		}
                              	}
                              
                              };
                              
                              #endif
                              
                              
                              1 Reply Last reply Reply Quote 0
                              • toxonicT
                                toxonic @Christoph Hart
                                last edited by

                                @Christoph-Hart Okay, i managed it to install Faust to a folder in my home directory and indeed: After pointing Hise to this directory the code works fine! :-)
                                On one hand that's good news and i'm lucky, that it's running. On the other hand, it is a bit annoying, that i can't install to the default directory and i don't know why. 🤔

                                bendursoB 1 Reply Last reply Reply Quote 0
                                • bendursoB
                                  bendurso @toxonic
                                  last edited by

                                  @toxonic I have the same error "expecting LPAR or DEF" in an effect made with Faust. The problem is only on Linux. I tried installing Faust again in a folder in my user directory, then changed the path of Faust on Hise, but it still gives me the error.

                                  Any ideas?

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post

                                  48

                                  Online

                                  1.7k

                                  Users

                                  11.7k

                                  Topics

                                  102.1k

                                  Posts