[Csnd] Help needed with Csound and Faust

Hi all! This is my first post to the Csound list.

I read Victor Lazzarini’s “Computer Music Instruments” recently and it got me excited about trying to improve the performance of a big real-time audio Csound project I’ve built by bringing in some faster (?) objects from Faust.

The current guidance with Faust seems to be to use the web-based IDE and export a Csound .dylib file. I’ve convinced myself that the Faust code works (it is just one of their examples for now) and that I’ve exported the .dylib file. When I try to use the opcode in Csound (full example code is at the end of this), I don’t get anywhere.

Folks have suggested several things so far:

  1. Maybe the web-based IDE doesn’t export code that works on M2 Macs.
  2. Try using the faust2csound tool in Faust instead.
  3. Maybe I need the “CSound Dev Kit.”

If 1 is true, that leads me to 2. I can’t get 2 to work, which leads me to 3.

Any guidance on getting this to work? I think I have Csound 6.18, no idea about the “dev kit.”

Thank you!
Bryan

form caption("Faust Opcode") size(400, 300), guiMode("queue") pluginId("def1") colour(0,0,0) rslider bounds(10,50,50,50), channel("window"), range(50, 10000, 1000,1, 1), text("window") rslider bounds(70, 50, 50, 50), channel("xfade"), range(1, 10000, 10,1, 1), text("xfade") rslider bounds(130, 50, 50, 50), channel("shift"), range(-12, 12, 0,1, 0.1), text("shift")

rslider bounds(250, 50, 50, 50), channel(“gain”), range(0, 1, 0 ,1, 0.01), text(“gain”)

-n -d --opcode-lib=/Users/bryantysinger/Documents/svn_checkouts/loobt_v1/Prototypes/Faust/pitch_shift.dylib ; Initialize the global variables. ksmps = 32 nchnls = 2 0dbfs = 1

instr 1

a1_in inch 1

kGain cabbageGetValue “gain”
kWindow cabbageGetValue “window”
kXfade cabbageGetValue “xfade”
kShift cabbageGetValue “shift”

; Generate osc with custom opcode
a_process pitchShifter a1_in, kWindow, kXfade, kShift
outs a1_inkGain, a_processkGain
endin

;causes Csound to run for about 7000 years... f0 z ;starts instrument 1 and runs it for a week i1 0 [60*60*24*7]

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Thanks Victor! That gave me some insight into where things were going wrong. There is a Csound header file (csdl.h) that wasn’t being included. It seems the path to it wasn’t being followed before (maybe because it has to follow an alias?), so I explicitly included it like this:
-I/Library/Frameworks/CsoundLib64.framework/Versions/6.0/Headers -L/Library/Frameworks/CsoundLib64.framework/Versions/6.0

Unfortunately, that then leads to compilation errors associated with the C++ code with some FAUST-specific macro variables when I try to compile the cpp file directly. I tried a few different compilers with the same issues.

I then tried to use the faust2csound tool instead, spelling out all of the -L and -I paths explicitly but that still doesn’t produce anything or give any error messages. This sort of thing:
faust2csound -I/Library/Frameworks/CsoundLib64.framework/Versions/6.0/Headers -L/Library/Frameworks/CsoundLib64.framework/Versions/6.0 -std=c++11 HPF.dsp

I feel like I’m close, but also pretty frustrated.
Bryan