### Parameter Management Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for getting and setting Csound instance parameters. ```APIDOC ## GET params(params) ### Description Gets the current set of parameters from a CSOUND instance. These parameters are in a CsoundParams structure. See `setParams()`. ### Method GET ### Endpoint params(params) ### Parameters #### Path Parameters - **params** (CsoundParams) - Required - A CsoundParams structure to be populated with current parameters. ``` -------------------------------- ### Run Csound using direct orchestra and score strings Source: https://csound.com/docs/ctcsound/ctcsound-API.html Configures options and compiles separate orchestra and score strings before starting performance. ```python import sys import ctcsound orc_text = ''' instr 1 out(linen(oscili(p4,p5),0.1,p3,0.1)) endin''' sco_text = "i1 0 5 1000 440" cs = ctcsound.Csound() result = cs.setOption("-d") result = cs.setOption("-odac") result = cs.compileOrc(orc_text) result = cs.readScore(sco_text) result = cs.start() while True: result = cs.performKsmps() if result != 0: break result = cs.cleanup() cs.reset() del cs sys.exit(result) ``` -------------------------------- ### Get Csound Parameters Source: https://csound.com/docs/ctcsound/ctcsound-API.html Retrieves the current parameters from a CSOUND instance into a CsoundParams structure. ```python p = CsoundParams() cs.params(p) ``` -------------------------------- ### Compile and perform using command-line arguments Source: https://csound.com/docs/ctcsound/ctcsound-API.html Demonstrates the host-driven performance loop using command-line arguments. ```python cs.compile_(args) while cs.performBuffer() == 0: pass cs.cleanup() cs.reset() ``` -------------------------------- ### 0dBFS Level Source: https://csound.com/docs/ctcsound/ctcsound-API.html Function to get the 0dBFS level. ```APIDOC ## GET /api/0dbfs ### Description Returns the 0dBFS level of the spin/spout buffers. ### Method GET ### Endpoint /api/0dbfs ### Response #### Success Response (200) - **level** (float) - The 0dBFS level. #### Response Example ```json { "level": -1.0 } ``` ``` -------------------------------- ### Csound Initialization and Server Management Source: https://csound.com/docs/ctcsound/ctcsound-API.html Methods for initializing the Csound library and managing UDP server instances. ```APIDOC ## csoundInitialize ### Description Initializes the Csound library with specific flags. ### Parameters #### Request Body - **flags** (int) - Required - Initialization flags. ### Response - **Return Value** (int) - Zero on success, positive if already initialized, negative on error. ## UDPServerStart ### Description Starts the UDP server on a supplied port number. ### Parameters #### Request Body - **port** (int) - Required - Port number to start the server on. ### Response - **Return Value** (int) - CSOUND_SUCCESS or CSOUND_ERROR. ``` -------------------------------- ### Compile and perform a CSD file Source: https://csound.com/docs/ctcsound/ctcsound-API.html Demonstrates the host-driven performance loop using a CSD file. ```python cs.compileCsd(args) while cs.performBuffer() == 0: pass cs.cleanup() cs.reset() ``` -------------------------------- ### Run Csound via command-line arguments Source: https://csound.com/docs/ctcsound/ctcsound-API.html Initializes a Csound instance and compiles using arguments provided via sys.argv. ```python import sys import ctcsound cs = ctcsound.Csound() result = cs.compile_(sys.argv) if result == 0: while cs.performKsmps() == 0: pass cs.cleanup() del cs sys.exit(result) ``` -------------------------------- ### Named GEN Name Source: https://csound.com/docs/ctcsound/ctcsound-API.html Gets the GEN name from a GEN number if it's a named GEN. ```APIDOC ## GET /namedGEN ### Description Gets the GEN name from a GEN number, if this is a named GEN. The final parameter is the max len of the string. ### Method GET ### Endpoint /namedGEN ### Parameters #### Query Parameters - **num** (integer) - Required - The GEN number. - **nameLen** (integer) - Required - The maximum length of the GEN name string. ``` -------------------------------- ### MIDI Device List Source: https://csound.com/docs/ctcsound/ctcsound-API.html Returns a list of available MIDI input or output devices. ```APIDOC ## GET /midiDevList ### Description Returns a list of available input or output midi devices. Each item in the list is a dictionnary representing a device. The dictionnary keys are _device_name_ , _interface_name_ , _device_id_ , _midi_module_ (value type string), _isOutput_ (value type boolean). Must be called after an orchestra has been compiled to get meaningful information. ### Method GET ### Endpoint /midiDevList ### Parameters #### Query Parameters - **isOutput** (boolean) - Required - True to list output devices, False for input devices. ``` -------------------------------- ### Csound Configuration Methods Source: https://csound.com/docs/ctcsound/ctcsound-API.html A collection of methods used to configure Csound instances, including MIDI, audio, and callback settings. ```APIDOC ## setLanguage(lang_code) ### Description Sets the language for Csound messages. Affects all Csound instances in the process. ### Parameters #### Request Body - **lang_code** (string) - Required - Language code (e.g., CSLANGUAGE_ENGLISH_UK, CSLANGUAGE_DEFAULT) --- ## setMIDIFileInput(name) ### Description Sets the MIDI file input name. ### Parameters #### Request Body - **name** (string) - Required - The path or name of the MIDI file. --- ## setOutput(name, type, format) ### Description Sets the output destination, file type, and format. ### Parameters #### Request Body - **name** (string) - Required - Output destination path. - **type** (string) - Required - File type (e.g., "wav", "aiff", "flac"). - **format** (string) - Required - Data format (e.g., "alaw", "float", "24bit"). --- ## setOption(option) ### Description Sets a single Csound option (flag). ### Parameters #### Request Body - **option** (string) - Required - The flag to set (no blank spaces allowed). ### Response #### Success Response (200) - **result** (int) - Returns CSOUND_SUCCESS on success. ``` -------------------------------- ### Compile and perform CSD text Source: https://csound.com/docs/ctcsound/ctcsound-API.html Demonstrates the host-driven performance loop using a string containing CSD content. ```python cs.compileCsdText(csd_text) while cs.performBuffer() == 0: pass cs.cleanup() cs.reset() ``` -------------------------------- ### Utility and Information Functions Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for retrieving Csound version, utility descriptions, and managing performance execution. ```APIDOC ## MYFLT ### Description Returns the size of MYFLT in bytes. ### Method GET ### Endpoint /MYFLT ## sleep ### Description Waits for at least the specified number of _milliseconds_. It yields the CPU to other threads. ### Method POST ### Endpoint /sleep #### Parameters ##### Request Body - **milliseconds** (int) - Required - The number of milliseconds to wait. ## sr ### Description Returns the number of audio sample frames per second. ### Method GET ### Endpoint /sr ## start ### Description Prepares Csound for performance. Normally called after compiling a csd file or an orc file, in which case score preprocessing is performed and performance terminates when the score terminates. However, if called before compiling a csd file or an orc file, score preprocessing is not performed and “i” statements are dispatched as real-time events, the tag is ignored, and performance continues indefinitely or until ended using the API. NB: this is called internally by `compile_()`, therefore it is only required if performance is started without a call to that function. ### Method POST ### Endpoint /start ## stop ### Description Stops a `perform()` running in another thread. Note that it is not guaranteed that `perform()` has already stopped when this function returns. ### Method POST ### Endpoint /stop ## stopUDPConsole ### Description Stops transmitting console messages via UDP. ### Method POST ### Endpoint /stopUDPConsole ## stringChannel ### Description Copies the string channel identified by _name_ into _string_. _string_ should contain enough memory for the string (see `channelDatasize()` below). ### Method POST ### Endpoint /stringChannel #### Parameters ##### Request Body - **name** (string) - Required - The name of the string channel. - **string** (string) - Required - The buffer to copy the string into. ## utilityDescription ### Description Gets utility description. Returns `None` if the utility was not found, or it has no description, or an error occurred. ### Method GET ### Endpoint /utilityDescription #### Parameters ##### Query Parameters - **name** (string) - Required - The name of the utility. ## version ### Description Returns the version number times 1000 (e.g., 5.00.0 = 5000). ### Method GET ### Endpoint /version ## waitBarrier ### Description Waits on the thread barrier. ### Method POST ### Endpoint /waitBarrier #### Parameters ##### Request Body - **barrier** (Barrier) - Required - The barrier object to wait on. ## waitThreadLock ### Description Waits for a thread lock to be released, with an optional timeout. ### Method POST ### Endpoint /waitThreadLock #### Parameters ##### Request Body - **lock** (Lock) - Required - The thread lock object. - **milliseconds** (int) - Optional - The maximum time in milliseconds to wait. ``` -------------------------------- ### Csound UDP and Utility Methods Source: https://csound.com/docs/ctcsound/genindex.html Methods for UDP communication and general utility functions. ```APIDOC ## POST /api/UDPConsole ### Description Starts or configures the UDP console for Csound. ### Method POST ### Endpoint /api/UDPConsole ### Parameters #### Query Parameters - **port** (number) - Optional - The UDP port to use. - **host** (string) - Optional - The host address. ### Request Example { "port": 5000, "host": "127.0.0.1" } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "UDP console configured" } ``` ```APIDOC ## POST /api/UDPServerClose ### Description Closes the UDP server. ### Method POST ### Endpoint /api/UDPServerClose ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "UDP server closed" } ``` ```APIDOC ## POST /api/UDPServerStart ### Description Starts the UDP server. ### Method POST ### Endpoint /api/UDPServerStart ### Parameters #### Query Parameters - **port** (number) - Required - The UDP port to listen on. ### Request Example { "port": 5001 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "UDP server started" } ``` ```APIDOC ## GET /api/UDPServerStatus ### Description Gets the status of the UDP server. ### Method GET ### Endpoint /api/UDPServerStatus ### Response #### Success Response (200) - **server_status** (string) - The status of the UDP server. ### Response Example { "server_status": "listening" } ``` ```APIDOC ## POST /api/unlockMutex ### Description Unlocks a mutex. ### Method POST ### Endpoint /api/unlockMutex ### Parameters #### Query Parameters - **mutex_id** (number) - Required - The ID of the mutex to unlock. ### Request Example { "mutex_id": 1 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "mutex unlocked" } ``` ```APIDOC ## GET /api/utilityDescription ### Description Gets a description of utility functions. ### Method GET ### Endpoint /api/utilityDescription ### Response #### Success Response (200) - **description** (string) - A description of available utility functions. ### Response Example { "description": "Provides access to various utility functions for Csound." } ``` -------------------------------- ### Csound Instance and Utility Functions Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for accessing the Csound instance, thread IDs, time, debug status, and environment variables. ```APIDOC ## GET /api/csound ### Description Returns the opaque pointer to the running Csound instance. ### Method GET ### Endpoint /api/csound ### Response #### Success Response (200) - **csound_instance** (pointer) - The opaque pointer to the Csound instance. #### Response Example ```json { "csound_instance": "0xabcdef123456" } ``` ## GET /api/thread/current_id ### Description Returns the ID of the currently executing thread, or null for failure. The return value can be used as a pointer to a thread object, but should not be compared as a pointer. The pointed to values should be compared, and the user must free the pointer after use. ### Method GET ### Endpoint /api/thread/current_id ### Response #### Success Response (200) - **thread_id** (pointer) - The ID of the current thread, or null. #### Response Example ```json { "thread_id": "0x112233445566" } ``` ## GET /api/time/current_samples ### Description Returns the current performance time in samples. ### Method GET ### Endpoint /api/time/current_samples ### Response #### Success Response (200) - **current_time_samples** (integer) - The current performance time in samples. #### Response Example ```json { "current_time_samples": 1234567 } ``` ## GET /api/debug ### Description Returns whether Csound is set to print debug messages. Those messages are sent through the DebugMsg() internal API function. ### Method GET ### Endpoint /api/debug ### Response #### Success Response (200) - **debug_enabled** (boolean) - True if debug messages are enabled, False otherwise. #### Response Example ```json { "debug_enabled": true } ``` ## GET /api/environment ### Description Gets the value of an environment variable. The searching order is: local environment of Csound, variables set with setGlobalEnv(), and system environment variables. ### Method GET ### Endpoint /api/environment ### Parameters #### Query Parameters - **name** (string) - Required - The name of the environment variable. - **withCsoundInstance** (boolean) - Optional - If True, searches the local Csound environment first. Should be called after compile_(). ### Response #### Success Response (200) - **value** (string) - The value of the environment variable, or null if not set. #### Response Example ```json { "value": "/path/to/variable" } ``` ``` -------------------------------- ### Timer Initialization Source: https://csound.com/docs/ctcsound/ctcsound-API.html Function for initializing timer structures. ```APIDOC ## POST /api/timer/init ### Description Initializes a timer structure. ### Method POST ### Endpoint /api/timer/init ### Parameters #### Request Body - **timerStruct** (pointer) - Required - The timer structure to initialize. ### Response #### Success Response (200) - **message** (string) - Success message. #### Response Example ```json { "message": "Timer structure initialized successfully." } ``` ``` -------------------------------- ### Environment and State Management Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for setting global environment variables and host-specific states. ```APIDOC ## POST /setGlobalEnv ### Description Sets the global value of environment variable `name` to `value`. The variable is deleted if `value` is `None`. It is not safe to call this function while any Csound instances are active. Returns zero on success. ### Method POST ### Endpoint /setGlobalEnv ### Parameters #### Request Body - **name** (string) - The name of the environment variable. - **value** (string | null) - The value to set, or null to delete the variable. ### Response #### Success Response (200) - **result** (integer) - Zero on success. #### Response Example { "result": 0 } ``` ```APIDOC ## POST /setHostData ### Description Sets host data. ### Method POST ### Endpoint /setHostData ### Parameters #### Request Body - **data** (any) - The host data to set. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setHostImplementedAudioIO ### Description Sets user handling of sound I/O. Calling this function with a `True` `state` value between creation of the Csound object and the start of performance will disable all default handling of sound I/O by the Csound library, allowing the host application to use the spin/spout/input/output buffers directly. For applications using spin/spout, `bufSize` should be set to 0. If `bufSize` is greater than zero, the buffer size (-b) will be set to the integer multiple of `ksmps()` that is nearest to the value specified. ### Method POST ### Endpoint /setHostImplementedAudioIO ### Parameters #### Request Body - **state** (boolean) - `True` to enable host-implemented audio I/O, `False` otherwise. - **bufSize** (integer) - The buffer size for audio I/O. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setHostImplementedMIDIIO ### Description Called with `state` `True` if the host is implementing via callbacks. ### Method POST ### Endpoint /setHostImplementedMIDIIO ### Parameters #### Request Body - **state** (boolean) - `True` if the host is implementing MIDI I/O via callbacks. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setInput ### Description Sets input source. ### Method POST ### Endpoint /setInput ### Parameters #### Request Body - **name** (string) - The name of the input source. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setIsGraphable ### Description Tells Csound whether external graphic table display is supported. Return the previously set value (initially False). ### Method POST ### Endpoint /setIsGraphable ### Parameters #### Request Body - **isGraphable** (boolean) - `True` if external graphic table display is supported, `False` otherwise. ### Response #### Success Response (200) - **previousState** (boolean) - The previously set value for `isGraphable`. #### Response Example { "previousState": false } ``` ```APIDOC ## POST /setLanguage ### Description Sets language to `lang_code`. ### Method POST ### Endpoint /setLanguage ### Parameters #### Request Body - **lang_code** (string) - The language code to set. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` -------------------------------- ### Callback Configuration Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for setting various callback functions to handle specific events. ```APIDOC ## POST /setAudioDevListCallback ### Description Sets a callback for obtaining a list of audio devices. This should be set by rtaudio modules and should not be set by hosts. (See `audioDevList()`) ### Method POST ### Endpoint /setAudioDevListCallback ### Parameters #### Request Body - **function** (function) - The callback function to set. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setCscoreCallback ### Description Sets an external callback for Cscore processing. Pass `None` to reset to the internal `cscore()` function (which does nothing). This callback is retained after a `reset()` call. ### Method POST ### Endpoint /setCscoreCallback ### Parameters #### Request Body - **function** (function | null) - The callback function to set, or null to reset. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setDebug ### Description Sets whether Csound prints debug messages. The debug argument must have value `True` or `False`. These messages come from the `DebugMsg()` internal API function. ### Method POST ### Endpoint /setDebug ### Parameters #### Request Body - **debug** (boolean) - `True` to enable debug messages, `False` to disable. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setDrawGraphCallback ### Description Called by external software to set Csound’s DrawGraph function. ### Method POST ### Endpoint /setDrawGraphCallback ### Parameters #### Request Body - **function** (function) - The callback function for drawing graphs. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExitGraphCallback ### Description Called by external software to set Csound’s ExitGraph function. ### Method POST ### Endpoint /setExitGraphCallback ### Parameters #### Request Body - **function** (function) - The callback function for exiting graphs. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExternalMidiErrorStringCallback ### Description Sets a callback for converting MIDI error codes to strings. ### Method POST ### Endpoint /setExternalMidiErrorStringCallback ### Parameters #### Request Body - **function** (function) - The callback function for MIDI error strings. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExternalMidiInCloseCallback ### Description Sets a callback for closing real time MIDI input. ### Method POST ### Endpoint /setExternalMidiInCloseCallback ### Parameters #### Request Body - **function** (function) - The callback function for closing MIDI input. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExternalMidiInOpenCallback ### Description Sets a callback for opening real-time MIDI input. ### Method POST ### Endpoint /setExternalMidiInOpenCallback ### Parameters #### Request Body - **function** (function) - The callback function for opening MIDI input. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExternalMidiOutCloseCallback ### Description Sets a callback for closing real time MIDI output. ### Method POST ### Endpoint /setExternalMidiOutCloseCallback ### Parameters #### Request Body - **function** (function) - The callback function for closing MIDI output. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExternalMidiOutOpenCallback ### Description Sets a callback for opening real-time MIDI output. ### Method POST ### Endpoint /setExternalMidiOutOpenCallback ### Parameters #### Request Body - **function** (function) - The callback function for opening MIDI output. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExternalMidiReadCallback ### Description Sets a callback for reading from real time MIDI input. ### Method POST ### Endpoint /setExternalMidiReadCallback ### Parameters #### Request Body - **function** (function) - The callback function for reading MIDI input. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setExternalMidiWriteCallback ### Description Sets a callback for writing to real time MIDI output. ### Method POST ### Endpoint /setExternalMidiWriteCallback ### Parameters #### Request Body - **function** (function) - The callback function for writing MIDI output. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setFileOpenCallback ### Description Sets a callback for receiving notices whenever Csound opens a file. The callback is made after the file is successfully opened. The following information is passed to the callback: pathname of the file; either full or relative to current dir, a file type code from the enumeration `CSOUND_FILETYPES`, 1 if Csound is writing the file, 0 if reading, 1 if a temporary file that Csound will delete; 0 if not. Pass NULL to disable the callback. This callback is retained after a `reset()` call. ### Method POST ### Endpoint /setFileOpenCallback ### Parameters #### Request Body - **function** (function | null) - The callback function to set, or null to disable. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setInputChannelCallback ### Description Sets the function to call whenever the `invalue` opcode is used. ### Method POST ### Endpoint /setInputChannelCallback ### Parameters #### Request Body - **function** (function) - The callback function for input channels. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` ```APIDOC ## POST /setKillGraphCallback ### Description Called by external software to set Csound’s KillGraph function. ### Method POST ### Endpoint /setKillGraphCallback ### Parameters #### Request Body - **function** (function) - The callback function for killing graphs. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure. #### Response Example { "status": "success" } ``` -------------------------------- ### Callback Registration and Management Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for registering and removing callback functions for keyboard and sense events. ```APIDOC ## POST /callbacks/keyboard ### Description Registers a general-purpose callback function for keyboard events. These callbacks are invoked by the `sensekey` opcode. ### Method POST ### Endpoint /callbacks/keyboard ### Parameters #### Request Body - **function** (function_pointer) - Required - The callback function to register. - **userData** (pointer) - Optional - User-defined data to be passed to the callback. - **type** (integer) - Optional - Bitwise OR of callback types for which the function should be called (0 for all types). ### Response #### Success Response (200) - **status** (string) - Indicates success (0), invalid input (CSOUND_ERROR), or memory error (CSOUND_MEMORY). #### Response Example ```json { "status": "success" } ``` ``` ```APIDOC ## DELETE /callbacks/keyboard ### Description Removes a previously registered keyboard callback function. ### Method DELETE ### Endpoint /callbacks/keyboard ### Parameters #### Request Body - **function** (function_pointer) - Required - The callback function to remove. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ``` ```APIDOC ## POST /callbacks/senseevents ### Description Registers a function to be called by the `sensevents()` opcode once in every control period. ### Method POST ### Endpoint /callbacks/senseevents ### Parameters #### Request Body - **function** (function_pointer) - Required - The callback function to register. - **userData** (pointer) - Optional - User-defined data to be passed to the callback. ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Csound Version and Threading Methods Source: https://csound.com/docs/ctcsound/genindex.html Methods for retrieving Csound version information and managing thread synchronization. ```APIDOC ## GET /api/version ### Description Gets the Csound version. ### Method GET ### Endpoint /api/version ### Response #### Success Response (200) - **csound_version** (string) - The version string of Csound. ### Response Example { "csound_version": "6.18.0" } ``` ```APIDOC ## POST /api/waitBarrier ### Description Waits at a barrier for thread synchronization. ### Method POST ### Endpoint /api/waitBarrier ### Parameters #### Query Parameters - **barrier_id** (number) - Required - The ID of the barrier. ### Request Example { "barrier_id": 1 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "waited at barrier" } ``` ```APIDOC ## POST /api/waitThreadLock ### Description Waits to acquire a thread lock. ### Method POST ### Endpoint /api/waitThreadLock ### Parameters #### Query Parameters - **lock_id** (number) - Required - The ID of the lock. ### Request Example { "lock_id": 2 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "acquired thread lock" } ``` ```APIDOC ## POST /api/waitThreadLockNoTimeout ### Description Waits indefinitely to acquire a thread lock. ### Method POST ### Endpoint /api/waitThreadLockNoTimeout ### Parameters #### Query Parameters - **lock_id** (number) - Required - The ID of the lock. ### Request Example { "lock_id": 3 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "acquired thread lock (no timeout)" } ``` ```APIDOC ## POST /api/writeCircularBuffer ### Description Writes data to a circular buffer. ### Method POST ### Endpoint /api/writeCircularBuffer ### Parameters #### Query Parameters - **buffer_id** (number) - Required - The ID of the circular buffer. - **data** (array) - Required - The data to write. ### Request Example { "buffer_id": 1, "data": [1, 2, 3] } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "data written to circular buffer" } ``` -------------------------------- ### State Management and Utilities Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for resetting Csound state, running external commands, and utilities. ```APIDOC ## POST /reset ### Description Resets all internal memory and state in preparation for a new Csound performance. Implies `cleanup()`. ### Method POST ### Endpoint /reset ### Parameters None ### Response #### Success Response (200) - **status** (string) - Indicates success or failure of the operation. #### Response Example ```json { "status": "success" } ``` ``` ```APIDOC ## POST /run/command ### Description Runs an external command with the specified arguments. The function can optionally wait for the command to finish. ### Method POST ### Endpoint /run/command ### Parameters #### Request Body - **args** (array of strings) - Required - A list of strings representing the command and its arguments. args[0] is the program name. - **noWait** (boolean) - Optional - If `False`, the function waits for the command to finish. Defaults to `False`. ### Response #### Success Response (200) - **result** (integer) - If `noWait` is `True`, returns the PID of the new process. If `noWait` is `False`, returns the exit status of the command (0-255). Returns a negative value on error. #### Response Example ```json { "result": 12345 } ``` ``` ```APIDOC ## POST /run/utility ### Description Runs a utility with the specified name and command line arguments. Should be called after loading utility plugins. Use `reset()` to clean up afterwards. ### Method POST ### Endpoint /run/utility ### Parameters #### Request Body - **name** (string) - Required - The name of the utility to run. - **args** (array of strings) - Optional - Command line arguments for the utility. ### Response #### Success Response (200) - **status** (string) - Indicates success (0) or failure. #### Response Example ```json { "status": "success" } ``` ``` -------------------------------- ### Buffer and Data Access Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for accessing audio buffers and library symbols. ```APIDOC ## GET /api/library/symbol ### Description Platform-independent function to get a symbol address in a shared library. ### Method GET ### Endpoint /api/library/symbol ### Parameters #### Query Parameters - **library** (string) - Required - The name of the shared library. - **symbolName** (string) - Required - The name of the symbol. ### Response #### Success Response (200) - **symbol_address** (pointer) - The address of the symbol in the shared library. #### Response Example ```json { "symbol_address": "0x1234567890ab" } ``` ## GET /api/audio/input_buffer ### Description Returns the Csound audio input buffer as an ndarray. ### Method GET ### Endpoint /api/audio/input_buffer ### Response #### Success Response (200) - **input_buffer** (ndarray) - The Csound audio input buffer. #### Response Example ```json { "input_buffer": [[0.1, 0.2], [0.3, 0.4]] } ``` ``` -------------------------------- ### Audio Input Information Source: https://csound.com/docs/ctcsound/ctcsound-API.html Retrieves information about the audio input. ```APIDOC ## GET /inputName ### Description Returns the audio input name (-i). ### Method GET ### Endpoint /inputName ``` -------------------------------- ### Csound Table Manipulation Methods Source: https://csound.com/docs/ctcsound/genindex.html Methods for creating, manipulating, and accessing Csound tables. ```APIDOC ## POST /api/table ### Description Creates or manipulates a Csound table. ### Method POST ### Endpoint /api/table ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the table. - **size** (number) - Optional - The size of the table. - **type** (string) - Optional - The type of the table (e.g., 'f', 'i'). ### Request Example { "table_id": 1, "size": 1024, "type": "f" } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "table operation successful" } ``` ```APIDOC ## POST /api/tableArgs ### Description Creates or manipulates a Csound table with specified arguments. ### Method POST ### Endpoint /api/tableArgs ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the table. - **args** (string) - Required - Arguments for table creation/manipulation. ### Request Example { "table_id": 2, "args": "1024, 0, 1" } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "table with args operation successful" } ``` ```APIDOC ## POST /api/tableCopyIn ### Description Copies data into a Csound table. ### Method POST ### Endpoint /api/tableCopyIn ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the destination table. - **data** (array) - Required - The data to copy. ### Request Example { "table_id": 3, "data": [0.1, 0.2, 0.3] } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "data copied into table" } ``` ```APIDOC ## POST /api/tableCopyInAsync ### Description Asynchronously copies data into a Csound table. ### Method POST ### Endpoint /api/tableCopyInAsync ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the destination table. - **data** (array) - Required - The data to copy. ### Request Example { "table_id": 4, "data": [0.4, 0.5, 0.6] } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "data copied into table asynchronously" } ``` ```APIDOC ## POST /api/tableCopyOut ### Description Copies data out of a Csound table. ### Method POST ### Endpoint /api/tableCopyOut ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the source table. - **num_elements** (number) - Required - The number of elements to copy. ### Request Example { "table_id": 5, "num_elements": 3 } ### Response #### Success Response (200) - **data** (array) - The data copied from the table. ### Response Example { "data": [0.7, 0.8, 0.9] } ``` ```APIDOC ## POST /api/tableCopyOutAsync ### Description Asynchronously copies data out of a Csound table. ### Method POST ### Endpoint /api/tableCopyOutAsync ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the source table. - **num_elements** (number) - Required - The number of elements to copy. ### Request Example { "table_id": 6, "num_elements": 3 } ### Response #### Success Response (200) - **data** (array) - The data copied from the table. ### Response Example { "data": [1.0, 1.1, 1.2] } ``` ```APIDOC ## GET /api/tableGet ### Description Gets a value from a Csound table at a specific index. ### Method GET ### Endpoint /api/tableGet ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the table. - **index** (number) - Required - The index within the table. ### Response #### Success Response (200) - **value** (number) - The value at the specified index. ### Response Example { "value": 0.5 } ``` ```APIDOC ## GET /api/tableLength ### Description Gets the length of a Csound table. ### Method GET ### Endpoint /api/tableLength ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the table. ### Response #### Success Response (200) - **length** (number) - The length of the table. ### Response Example { "length": 1024 } ``` ```APIDOC ## POST /api/tableSet ### Description Sets a value in a Csound table at a specific index. ### Method POST ### Endpoint /api/tableSet ### Parameters #### Query Parameters - **table_id** (number) - Required - The ID of the table. - **index** (number) - Required - The index within the table. - **value** (number) - Required - The value to set. ### Request Example { "table_id": 7, "index": 5, "value": 0.75 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "value set in table" } ``` -------------------------------- ### Csound Random Seed and Channel Methods Source: https://csound.com/docs/ctcsound/genindex.html Methods for managing random number generation and audio/control channels. ```APIDOC ## POST /api/seedRandMT ### Description Seeds the Mersenne Twister random number generator. ### Method POST ### Endpoint /api/seedRandMT ### Parameters #### Query Parameters - **seed** (number) - Required - The seed value for the random number generator. ### Request Example { "seed": 12345 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "random seed set" } ``` ```APIDOC ## POST /api/setAudioChannel ### Description Sets an audio channel for Csound. ### Method POST ### Endpoint /api/setAudioChannel ### Parameters #### Query Parameters - **channel_name** (string) - Required - The name of the audio channel. - **value** (number) - Required - The value to set for the audio channel. ### Request Example { "channel_name": "myAudioOut", "value": 0.5 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "audio channel set" } ``` ```APIDOC ## POST /api/setControlChannel ### Description Sets a control channel for Csound. ### Method POST ### Endpoint /api/setControlChannel ### Parameters #### Query Parameters - **channel_name** (string) - Required - The name of the control channel. - **value** (number) - Required - The value to set for the control channel. ### Request Example { "channel_name": "myControl", "value": 1.0 } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "control channel set" } ``` ```APIDOC ## POST /api/setStringChannel ### Description Sets a string channel for Csound. ### Method POST ### Endpoint /api/setStringChannel ### Parameters #### Query Parameters - **channel_name** (string) - Required - The name of the string channel. - **value** (string) - Required - The string value to set. ### Request Example { "channel_name": "myString", "value": "hello" } ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. ### Response Example { "status": "string channel set" } ``` -------------------------------- ### Audio Output Format and Name Source: https://csound.com/docs/ctcsound/ctcsound-API.html Functions for retrieving audio output format and name. ```APIDOC ## GET outputFormat() ### Description Gets output type and format. ### Method GET ### Endpoint outputFormat() ``` ```APIDOC ## GET outputName() ### Description Returns the audio output name (-o). ### Method GET ### Endpoint outputName() ``` -------------------------------- ### Display Message Source: https://csound.com/docs/ctcsound/ctcsound-API.html Displays an informational message in Csound. ```APIDOC ## POST /message ### Description Displays an informational message. This is a workaround because **ctypes** does not support variadic functions. The arguments are formatted in a string, using the python way, either old style or new style, and then this formatted string is passed to the Csound display message system. ### Method POST ### Endpoint /message ### Parameters #### Request Body - **fmt** (string) - Required - The format string. - **args** (list) - Optional - Arguments to format into the string. ```