instr 1 | Starts an instrument block. |
idur = p3 | The duration is set to p3 |
idurosc = 1/idur | The duration of the amplitude envelope is set to 1/idur |
iamp = (p4 > 0.0 ? (p4*0.001*0dbfs) : (ampdbfs (p4))) | The variable p4 sets the amplitude. Linear values from 0 to 1000 or in dB from 0 to negative values |
iaenv = p5 | Function table number of the wave form of the amplitude envelope (GEN routine) |
aenv poscil iamp, idurosc, iaenv | Amplitude envelope |
asig rand aenv | The opcode "rand" generates a controlled random number at audio rate with aenv as amplitude envelope, then writes the output to the audio variable "asig" |
out asig | The opcode "out" writes the audio data to an external device or stream. |
endin | Ends the current instrument block |
This simple orchestra is a white noise generator with the amplitude envelope control.
Copy the complete following instructions in a text file and save it as"myclass2.orc".
sr = 96000
kr = 96000
ksmps = 1
nchnls = 1
0dbfs = 8388607
instr 1
idur = p3
idurosc = 1/idur
iamp = (p4 > 0.0 ? (p4*0.001*0dbfs) : (ampdbfs (p4)))
iaenv = p5
aenv poscil iamp, idurosc, iaenv
asig rand aenv
out asig
endin
|
The "Classes in package Csound Tables" will appear. |
|
The icon of aenv must change into a BPF icon (look at the picture), and this slot will have a GEN7 subroutine as default value. |
Initialise always with a Csound table the slots witch stand for a BPF or a Csound GEN function number.
To more details about the slots of the OMChroma classes see Class Input Slots.
The example A checks the default values of the new class. The example B uses a BPF as amplitude envelope. The example C uses use a GEN subroutine as amplitude envelope. |