Tools for Sound Processing
147
loops
f 1
0
1048576 1 "march.aiff" 0
0
1
; p1 p2 p3
p4 p5
i 1
0
25
2.0
;sound-production note
i 2
0
25
0.1 1.0
;sound-processing note
The code can be easily understood by means of the comments and by refer-
ence to the Csound manual [106]. We only observe that both the sound produc-
tion and processing are activated by means of notes on different instruments.
The communication between the two instruments is done by means of the global
variable gas. The audio file is preliminarly loaded in memory by means of the
statement f of the score file. The table containing the sound file is then read by
instrument 1 using the UG loscil, that is a sort of sampling device where the
reading speed and iteration points (loops) can be imposed.
To understand how SAOL is structurally similar to CSound but syntacti-
cally more modern, we propose some SAOL code for the same solution to our
processing problem. The orchestra is
global {
outchannels 1;
srate 22000;
krate 220;
table tabl(soundfile, -1, "march.aiff");
route (bus1, generator);
//
delay
amplitude
send (effect;
0.1,
1.0; bus1);
}
instr generator(env_ext) {
// env_ext: target point of the linear envelope (from 1 to env_ext)
ksig freq;
asig signa;
imports table tabl;
ivar lentab;
lentab = ftlen(tabl)/s_rate; //table length in seconds
freq = kline(1, dur, env_ext);
signa = oscil(tabl, freq/lentab, 1);
output(signa);
}
instr effect(del,ampl) {
// del: echo delay in seconds
// ampl: amplitude of the echo
asig signa;
signa = delay(input, del);
output(input + ampl*signa);
Next Page >>
<< Previous Page
Back to the Table of Contents