Soundscrape is clearly out of the domain of traditional synthesizers when it comes to programmatic patch construction.
The multichannel support described above can be applied to construct parallel signal flow graphs:
;; Look up what 'map' does in the references
(let ((n 16)) ;; number of oscillators
(play ;; play the synthesis network made by
(mix ;; mixing together
(map ;; a list comprised of the results of calling
(lambda (l) ;; <-- this function,
(audio sine ;; which creates a sine oscillator
(+ 200 (random 1000.0)) ;; at a random frequency
(/ 0.5 n))) ;; and a scaled-down amplitude,
(make-list n)))));; <-- on each member of this listTo connect a number of filters together in a series, you will need to use the recursion control structures we talked about last time.
(play ;; play the synthesis network made by
(let loop ((in (audio decay ;; the initial input: a decaying
(audio impulse 0.5) ;; impulse
0.2 ;; with a decay time of 0.2 s
(audio pink-full-frequency 0.2))))
;; enveloping a pink noise source
(if (> (random 1.0) 0.9) ;; if this test passes (1 in 10 chance),
in ;; return the filter graph as it is
(loop (audio allpass-n ;; otherwise add an allpass filter to the
in ;; chain, with the existing graph as an input,
0.05 ;; a max delay time of 0.05 s
(random 0.05) ;; a random delay time
3))))) ;; and an echo decay time of 3 s, and loop
;; againThe previous example also shows an example of runtime patch construction -- the chain of allpass delays could be 10 units long, or nothing at all, or even 100. It's all random, yo.