Csound¶
Generates Csound opcode plugins via the csdl.h C API. The opcode is discovered by Csound at startup from the OPCODE6DIR64 directory.
OS support: macOS, Linux
Prerequisites¶
- Python >= 3.10
- C++ compiler
- make
- Csound headers (
csdl.h) -- from the CsoundLib64 framework (macOS), or thecsound/libcsound-devpackage (Linux)
Quick Start¶
# From a gen~ export
gen-dsp ./my_export -n myeffect -p csound
cd myeffect_csound && make all
# Verify Csound discovers the opcode
OPCODE6DIR64=. csound --list-opcodes | grep myeffect
Usage in a .csd File¶
Audio inputs map to a-rate args, parameters to k-rate args, audio outputs to a-rate outputs:
; Effect (2 audio in, 2 audio out, 8 k-rate params)
aout1, aout2 gigaverb ain1, ain2, kroomsize, krevtime, kdamping, ...
; Generator (0 audio in, 1 audio out, 5 k-rate params)
aout fm_synth kgate, kfreq, kmod_ratio, kmod_index, kamp
How It Works¶
gen_ext_csound.cppimplements the OENTRY registration, init callback (creates gen~ state), and perf callback (per-ksmps-block processing)_ext_csound.cppwraps genlib (header isolation pattern)- OENTRY type strings are auto-generated from the gen~ manifest I/O counts (e.g.
"aa"outputs,"aakkkkkkkk"inputs for 2in/2out/8params) - Handles float (gen~/GENLIB_USE_FLOAT32) to MYFLT (double, Csound default) conversion
- Supports sample-accurate timing via
ksmps_offset/ksmps_no_end - The plugin registers via
LINKAGE_BUILTINwhich exportscsound_opcode_init()
Header Discovery¶
The Makefile searches for Csound headers in this order:
CSOUND_INCLUDEenvironment variable (explicit override)/Library/Frameworks/CsoundLib64.framework/Headers(macOS framework)$(brew --prefix)/include/csound(Homebrew)/usr/local/include/csound/usr/include/csound