create
Creates a new instrument definition, instrument instance, or opcode object.
Syntax
Initialization
code -- String containing Csound language code for an instrument.
instr -- compiled instrument definition.
opc -- opcode definition, supplied directly or looked up by name with opcoderef
overload -- (optional, defaults to 0) opcode overload (version) (see opcodeinfo)
len -- opcode object array length.
All forms run at initialization. The string form takes an instrument body without instr or endin, compiles it and returns an InstrDef. createinstr is another name for this form.
create(definition) allocates an Instr instance without scheduling it. Use init to initialize it, then perf to run it from the calling instrument. For an instance that Csound performs automatically, use play or schedule.
The Opcode form creates one object from the chosen overload. The array form creates a one-dimensional Opcode[] with len independent objects. Use a nonnegative integer for len. Creating an opcode object does not run its initialization or performance code. Use run, or separate init and perf calls, to execute it.
Arrange delete in the owning instrument for cleanup. The object guide explains lifetimes and gives examples of each form.
Examples
Here is an example of the create opcode. It uses the file create.csd.
See also
Instrument definitions, instances and opcode objects, delete, init, perf
Credits
Author: Victor Lazzarini
Maynooth University
Ireland
Csound 7, 2024