play, render, recordSo now we know how to make a basic synthesis network. We still don't know how to make the thing go, though. Actually running the network is a job for play, render, and record. The first plays the sound in realtime, the second writes the output to disk in non-realtime, and the third does both in realtime.
The first (required) argument to each of these functions is an output or a list of outputs of a synthesis network, generally the return value of the audio or control functions. The optional second argument is how long the network is to be executed. write and record both take more arguments: the file name, the file type, and the file format. Some examples:
Tip: The code examples in this and other sections can be copied and pasted directly into an open soundscrape session.
(play (audio sine) 5) ;; play a sine wave at the default frequency and
;; amplitude for five seconds
(play (audio sine)) ;; play a sine wave at the default frequency and
;; amplitude until the user presses Control-C
(render (audio sine) ;; the same synthesis network,
5 ;; for five seconds,
"sine.wav" ;; rendered to the file "sine.wav"
;; (in the current directory)
'wav ;; as a WAV file (the default)
'signed-16-bit-pcm) ;; written with signed 16 bit pcm data
;; (the default)
(record (audio sine)
5
"sine2.wav") ;; we can omit arguments that have default values