René Nyffenegger's collection of things on the web | |
René Nyffenegger on Oracle - Most wanted - Feedback
- Follow @renenyffenegger
|
Variables in CSound | ||
Types of variables
There are three types of variables in Csound: i-variables, k-rate variable and a-rate variables.
i Variables
i-variables are set when an instrument starts to play and are not changed. These variables must start with the letter i.
k-rate variables
k-rate variables are changed with the k-rate (see kr).
a-rate variables
a-rate variables are changed with the a-rate (see sr).
global variables
Actually, there are more than three types of variables: each type can be global, in which case the variable name must be
preceeded by a g.
Differences between k-rate and a-rate variablessr = 44100 kr = 4410 nchnls = 1 instr 1 ilen = p3 kvel line 0, ilen, 3 ksig tablei kvel, 1 asig = ksig out asig*32000 endin f1 0 4 7 0 4 1 i1 0 0.0009070294 ; With audio rate 44100, the length is 40
This setup produces:
![]()
Now, the orc file is slightly changed:
sr = 44100 kr = 4410 nchnls = 1 instr 1 ilen = p3 kvel line 0, ilen, 3 asig tablei kvel, 1 out asig*32000 endin
This orchestra produces a totally different output:
![]() |