148
D. Rocchesso: Sound Processing
audio busses
Digital Signal Processor
(DSP)
}
while the score reduces to the line
0.00
generator 25.0 2.0
In SAOL, variable names, parameters, and instruments are handled more
clearly. The block enclosed by the keyword global contains some features shared
by all instruments in the orchestra, such as the sample and control rate, or the
audio files that are accessed by means of tables. Moreover, this section contains
a configuration of the audio busses where signal travels. In the example the
generator instrument sends its output to the bus called bus1. From here, signals
are sent to the effect unit together with the processing parameters del and
ampl, In the global section it is possible to program arbitrarily-complex paths
among production and processing units.
Let us examine how the same kind of processing can be done in CLM. Here
we do not have an orchestra file, but we compose as many files as there are
generation or processing instruments. Every instrument is defined by means of
the LISP macro definstrument, and afterwords it can be compiled and loaded
within the LISP environment as a primitive function. The code segment that is
responsible for audio sample generation is enclosed within the Run macro, that is
expanded into C code at compilation time. In the past, the Run macro could also
generate code for the fixed-point Digital Signal Processor (DSP) Motorola 56000,
that was available in NeXT computers, in order to speed up the computations.
In contemporary general-purpose computers there is no longer an advantage in
using DSP code, as the C-compiled functions are very efficient and they do not
suffer from artifacts due to fixed-point arithmetics.
Here is the CLM instrument that reads an audio file at variable speed:
(definstrument sweep (file &key
;; parameters:
;; DURATION of the audio segment to be acquired (seconds)
;; AMPSCL: amplitude scaling
;; FREQ-ENV: frequency envelope
(duration 1.0) (ampscl 1.0) (freq-env '(0 1.0 100 1.0)) )
(let ((f (open-input file))) ;; input file assigned to variable f
(let*
((beg 0)
;; initial inst.
(end (+ beg (floor (* sampling-rate duration)))) ;; final inst.
(freq-read-env (make-env :envelope freq-env )) ;; freq. env.
(sr-convert-a (make-resample :file f :srate 1.0 ))
;; sr-convert-a: var. containing the acquired file
(out-sig-a 0.0) )
;; dummy var.
(Run
(loop for i from beg to end do
(setf out-sig-a (* ampscl (resample sr-convert-a
(env freq-read-env))))
;; transposition envelope (in octaves)
(outa i out-sig-a)
(if *reverb* (revout i out-sig-a))
)))))
Next Page >>
<< Previous Page
Back to the Table of Contents