HISE Logo Forum
    • Categories
    • Register
    • Login

    Error message with FAUST in HISE

    Scheduled Pinned Locked Moved Faust Development
    15 Posts 4 Posters 725 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.
    • 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

                          27

                          Online

                          1.7k

                          Users

                          11.7k

                          Topics

                          102.0k

                          Posts