Header files
The main header to include:Core types
CSOUND
Opaque pointer to a Csound instance:CSOUND* pointer as their first argument.
MYFLT
Floating-point type for audio samples:csoundGetSizeOfMYFLT() to check the size at runtime.
Status codes
OPARMS
Configuration parameters structure:Instantiation
csoundInitialize
Initialize Csound library:flags- Initialization flags (combination ofCSOUNDINIT_*constants)
CSOUNDINIT_NO_SIGNAL_HANDLER- Don’t install signal handlersCSOUNDINIT_NO_ATEXIT- Don’t install atexit callbacks
csoundCreate
Create a Csound instance:hostData- Optional pointer to host data (can be NULL)opcodedir- Override for plugin directory (can be NULL)
csoundDestroy
Destroy a Csound instance:Compilation
csoundCompileCSD
Compile a CSD file:csound- Csound instancepath- Path to CSD filemode- Compilation mode (0 for normal)realtime- Realtime mode flag
CSOUND_SUCCESS on success, error code otherwise
Example:
csoundCompileOrc
Compile an orchestra string:csound- Csound instancestr- Orchestra code stringasync- Asynchronous compilation flag (0 or 1)
CSOUND_SUCCESS on success, error code otherwise
Example:
csoundEvalCode
Evaluate an expression:Performance
csoundStart
Prepare Csound for performance:CSOUND_SUCCESS on success
csoundPerformKsmps
Process one control period (ksmps samples):csoundReset
Reset Csound instance:Attributes
csoundGetVersion
Get Csound version:csoundGetSr
Get sample rate:csoundGetKr
Get control rate:csoundGetKsmps
Get samples per control period:csoundGetChannels
Get number of output channels:isInput- 0 for output channels (nchnls), 1 for input channels (nchnls_i)
csoundGet0dBFS
Get 0dBFS level:Audio I/O
csoundGetSpin
Get input audio buffer:csoundGetSpout
Get output audio buffer:Channels
Channel types
csoundSetControlChannel
Set a control channel value:csoundGetControlChannel
Get a control channel value:name- Channel nameerr- Optional pointer to error code (can be NULL)
csoundGetChannelPtr
Get direct pointer to channel:Score events
csoundEventString
Send a score event as string:csoundEvent
Send a score event as array:CS_INSTR_EVENT- Instrument event (i-statement)CS_TABLE_EVENT- Table event (f-statement)CS_END_EVENT- End event (e-statement)
Tables
csoundTableLength
Get table length:csoundGetTable
Get pointer to table data:Complete example
Next steps
C++ bindings
Object-oriented C++ interface
Performance thread
Threaded performance utilities
Python bindings
Use Csound from Python
API reference
Complete C API documentation