Post Go back to editing

faust compilation problems with online editor and getting a working solution

Category: Software
Product Number: sharc audio module v2.1
Software Version: CCES 2.12

Hi,


I have the SAM audio board and can add the faust volume example from the link below and it builds and runs perfectly.
https://github.com/moforte/sam-faust/tree/master/faust-examples/volume/volume-sam

I have seen similar issues for example

ez.analog.com/.../478364


but if i compile the example using the online editor (https://fausteditor.grame.fr/) i get many errors on the build process on CCES.

in previous help version 2.6.1 of faust has been referred too but i can't find that on the repository so i have installed 2.60.3 for win64 (github.com/.../releases).
but i need some help on how to use it on windows.

The documentation pdf 'faust2sam Integration with the SHARC Audio Module Platform' section 1.4 it states that 'Currently, Faust is easily compiled and run on Mac/OS X machines and Linux machines. This document describes how to download, compile and
install Faust on a Mac/OS X machine'

so how do i use the windows version ?

i can see the 'faust.exe' and have listed the extensive help file but need some advice on how to use to compile a .dsp file to the files to drop into my CCES project.

Many thanks

  • with reference to this post 

    New version of Faust isn't compatible with CCES BareMetal FrameWork. - Q&A - SHARC Audio Module - EngineerZone (analog.com)

    There is a reference to version 2.6.1 of faust.

    I have found a document in Italian which describes how they resolved the issues.  I'm working my way through it but have come across an issue of getting GCC 5 and will have to download the source and compile it !!!!!!

    and whatever issues arise from that.  I'm not a linux expert so am having to figure this out as i go.

    section 3 is the relevant start of how to make faust work. Google translate does a really good job.

    https://tesi.univpm.it/retrieve/d481806d-a5fb-4f47-9761-985cc65ae384/Tesi.pdf

    hopefully this may help someone. If they can figure out how to implement it. Please share if they do.

  • My work around to trying to compile a .dsp file from faust so it will build in CCES
    --------------------------------------------------------------------------------------

    The path using linux was creating a headache as i'm not familiar with linux and even the fantastic
    description in the link below brought up many other issues.

    tesi.univpm.it/.../Tesi.pdf


    here is a list of what i done to get something from a windows version of faust. It's not pretty but it seems to work for me.

    i am using CCES product version 2.12.0.0

    1.
    install windows version of Faust - version 2.15.11. - yes, i know its old but that is the most current version i can get to compile a .dsp project and with some editing work with CCES.
    Faust-2.15.11-win64.exe

    here is link to page about faust versions
    github.com/.../releases

    here is shortcut to download version 2.15.11.
    github.com/.../Faust-2.15.11-win64.exe


    install the .exe


    2.
    this part is just to show how i got information about the faust compiler and not needed to get things to work.
    i intend to use the faust compiler in (faust.exe in C:\Program Files\Faust\bin) but i need to know what information to pass to it.
    I used the online editor (https://fausteditor.grame.fr/) to create the 3 files required by the CCES compiler.
    This uses the latest compiler but that doesn't matter as i only need some information about how the compiler is used as reference.

    in this link there is an explaination of how to do this.
    wiki.analog.com/.../ex-work-volume

    a. just export (press the truck symbol) the default code on the screen when first goto https://fausteditor.grame.fr/
    b. select 'sam' in first drop down and midi in the second drop down.
    c. press Export and download files.

    look in the file 'samFaustDSP.cpp'

    at about line 8 are the compilation options used.


    3.
    create a folder called 'faust_wip'

    in this example i'm going to compile the 'volume.dsp' example from the github examples.
    here is the link to examples.

    github.com/.../faust-examples

    from github.com/.../volume
    download 'volume.dsp' this will be our file to compile using the installed compiler.
    put 'volume.dsp' in the 'faust_wip' folder

    from github.com/.../volume-sam
    download the following files.

    fast_pow2.h
    SamFaustDSP.cpp
    samFaustDSP.h

    copy these files into sub folder of 'faust_wip' called 'volume_example'
    fast_pow2.h and samFaustDSP.h will be used later. We will create our own version of 'SamFaustDSP.cpp'.
    This i found to work fine with CCES. but thats not going to help with creating our own code.


    4.
    create a .bat file called 'compile_faust' with the following:

    cd C:\Program Files\Faust\bin
    faust -a sam/samFaustDSP.cpp -lang cpp -i %1 -es 1 -mcd 16 -single -ftz 0 -o %~dp0samFaustDSP.cpp
    pause

    put the bat file in the folder 'faust_wip' so the dsp file and bat file are in the same folder.

    5.
    open a cmd window and goto the location of the bat file 'compile_faust'
    type the following:

    compile_faust volume.dsp

    a file called 'samFaustDSP.cpp' should be created in the 'faust_wip' folder.


    6.
    in your CCES project copy the following files to core1->src->faust.

    fast_pow2.h downloaded from volume example.
    SamFaustDSP.cpp THE FILE JUST CREATED. NOT THE EXAMPLE DOWNLOADED FROM GITHUB.
    samFaustDSP.h downloaded from volume example.


    7.
    if you compare the downloaded example and created example of 'samFaustDSP.cpp' they are mostly similar but errors occur if build in CCES.
    These are the errors i found and their solutions.

    problem:
    error: this dynamic_cast cannot be done without runtime type information, which is disabled

    solution:
    goto properties -> Language settings/
    tick C++ exceptions and RTTI (-eh -rtti)


    problem:
    error: namespace "std" has no member "cerr"

    solution:
    comment out lines with this error - even in the example from github the lines with cerr are commented out


    problem:
    error: namespace "std" has no member "stringstream"

    solution:
    replace stringstream with ostringstream


    8.
    other changes. so if FAUST is disabled in CCES the code will be disabled.

    in the example version at the begining of SamFaustDSP.cpp is the following. put this at begining of your created version.

    #include "common/audio_system_config.h"
    #include "./samFaustDSPCore.h"
    #if USE_FAUST_ALGORITHM
    #define MIDICTRL 1


    9.
    also put at the very end of your created version of SamFaustDSP.cpp the following.

    #endif


    10.

    if you don't have a midi connection and want to change the volume. do this


    virtual void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs) {

    FAUSTFLOAT fVsliderTEST = -7; // set to dB level 0 to -70


    FAUSTFLOAT* input0 = inputs[0];
    FAUSTFLOAT* input1 = inputs[1];
    FAUSTFLOAT* output0 = outputs[0];
    FAUSTFLOAT* output1 = outputs[1];
    //ORIGINAL float fSlow0 = (0.00100000005f * std::pow(10.0f, (0.0500000007f * float(fVslider0))));
    float fSlow0 = (0.00100000005f * std::pow(10.0f, (0.0500000007f * float(fVsliderTEST))));


    for (int i = 0; (i < count); i = (i + 1)) {
    fRec0[0] = (fSlow0 + (0.999000013f * fRec0[1]));
    output0[i] = FAUSTFLOAT((float(input0[i]) * fRec0[0]));
    output1[i] = FAUSTFLOAT((float(input1[i]) * fRec0[0]));
    fRec0[1] = fRec0[0];

    }

    }

  • Hi Beaker,

    We are here to help you out. For better assistance, could you please let us know the BareMetal framework version you are using.

    Best,
    Aradhita

  • Hi Aradhita,

    thank you for getting back to me.  I appreciate any help on this.  

    I am using version 2.0.0 of the BareMetal framework.  I just created a new project from the wizard in CCES version 2.12.0.0

    Best regards

  • i forgot one thing.

    In CCES Project properties set - > Settings - > CrossCore SHARC C/C++ Compiler -> Language Settings. Please tick the box 'Compile C++ source files with C++ 11feature extentions (-c++11)

  • added stuff.

    in 'faust2sam' in C:\Program Files\Faust\bin
    at line 49 it has the compiler command

    faust -i -a sam/samFaustDSP.cpp $OPTIONS "$FILE" -o "$APIFOLDER/samFaustDSP.cpp" || exit 1

    which roughly translates to

    faust -a sam/samFaustDSP.cpp -o %~dp0samFaustDSP.cpp


    at line 60 it adds the includes and endif as described earlier

    at line 76 it even has the fixes so it will compile on sharc.
    sed -e 's/\(std::cerr.*;\)/\/* \1 *\/ /' \
    -e 's/std::cout/\/\/std::cout/' \
    -e 's/getCPULoad(void/faustGetCPULoad(void/' \
    -e 's/std::stringstream/std::ostringstream/' \
    -e 's/dynamic_cast/static_cast/' \

  • Hi Beaker, 

    The Faust version has been modified over time and is not compatible with CCES compiler. We have found a workaround for this : 

    1. Please install Faust version 2.14.4 (Releases · grame-cncm/faust (github.com)).
    2. Download the volume.dsp from the online editor.
    3. Create the 3 C++ code files using this faust version by the command "faust2sam volume.dsp".
    4. Modify the "samFaustDSP.cpp" with the following, so that the code is compiled without any error.
    • audio() : fShutdown(NULL), fShutdownArg(NULL) {}
    • for (std::set<std::pair<compute_callback, void*> >::iterator it = fComputeCallbackList.begin(); it != fComputeCallbackList.end(); ++it) {
      it->first(it->second);
      }

              5. Copy paste the 3 files in Faust folder in core1 and core2 folders.

    This will build the code without any errors. I hope this helps to answer your concern.