146
D. Rocchesso: Sound Processing
legato
allows to hold a note (ihold), in such a way that the following note of the
same instrument can be treated differently during the initialization (tigoto).
For instance, these commands can be used to implement a smooth transition
between notes, as in a legato.
An interesting aspect that has to be considered is how the sound-processing
languages acquire pre-recorded material for processing. In Csound there is the
primitive soundin that acquires the samples from an audio file for as long as the
note that invoked the instrument remains active. Alternatively, with the function
table statement f a table can be loaded with the content of an audio file, and
such table can be read later on by UGs such as table or oscil. This strategy
allows to perform important modifications, such as transposition, stretching,
grain extraction, already at the reading stage.
The Csound architecture, largely inherited from Music V, is more oriented
toward sound synthesis than sound manipulation. For instance, a reverb contin-
ues to produce meaningful signal even when its input has ceased to be active,
and this fact has produced the practice to call the UG reverb by means of a
separate instrument that takes its input from global orchestra variables. On the
other hand, in CLM sound transformations are more clearly stated since any
filter can have a sound file name among its parameters. For CLM, a reverb is any
filter whose invocation is made explicit as an argument of a sound-generation
function.
B.2.2
Examples in Csound, SAOL, and CLM
Let us face the problem of reading an audio fragment memorized in the file
"march.aiff" and to process it by means of a linearly-increasing transposition a
100ms echo.
A Csound solution is found in the following orchestra and score files:
; sweep.orc
sr = 22000
;audio rate
kr = 220
;control rate
ksmps = 100
;audio rate / control rate
nchnls = 1
;number of channels
instr 1
;sound production
ilt
= ftlen(1)/sr
;table length in samples
kfreq
line
1, p3, p4
;linear envelope from 1 to p4 in p3 seconds
gas
loscil
25000, kfreq/ilt, 1, 1/ilt, 0, 1, ftlen(1)
;frequency-varying oscillator on table 1
endin
instr 2
;sound processing
as
delay
gas, p4
;p4 seconds delay on global variable gas
out p5*as + gas
;input + delayed and attenuated signal
endin
; sweep.sco
; table stored from sound file
; # time size
file
skip
format chan