summaryrefslogtreecommitdiff
path: root/extsnd.html
diff options
context:
space:
mode:
authorAlessio Treglia <quadrispro@ubuntu.com>2010-03-21 19:48:41 +0100
committerAlessio Treglia <quadrispro@ubuntu.com>2010-03-21 19:48:41 +0100
commit08d24d7a5682e59434c3da226fb1f2546c0ebd86 (patch)
tree4d2c0b5fb0a4bf2b0a4845d91e28f6a5dcc1c11f /extsnd.html
parentd136f8f7d28ea86f3f040e95aef4c7a95ea8b7e2 (diff)
Imported Upstream version 11.4
Diffstat (limited to 'extsnd.html')
-rw-r--r--extsnd.html44
1 files changed, 22 insertions, 22 deletions
diff --git a/extsnd.html b/extsnd.html
index 87b585d..aebe99f 100644
--- a/extsnd.html
+++ b/extsnd.html
@@ -112,14 +112,12 @@
<li><a href="grfsnd.html#sndaswidget" onmouseout="UnTip()" onmouseover="Tip('Embed Snd in some other program')">Snd as a Widget</a>
<li><a href="grfsnd.html#sndwithclm" onmouseout="UnTip()" onmouseover="Tip('CLM is built into Snd')">Snd and CLM</a>
<li><a href="grfsnd.html#sndwithcm" onmouseout="UnTip()" onmouseover="Tip('CM is Rick Taube\'s composition environment')">Snd and Common Music</a>
- <li><a href="grfsnd.html#sndwithpd" onmouseout="UnTip()" onmouseover="Tip('PD is Miller Puckette\'s synthesis and composition program')">Snd and Pd</a>
<li><a href="grfsnd.html#sndwithmotif" onmouseout="UnTip()" onmouseover="Tip('Motif extensions from xm.c')">Snd and Motif</a>
<li><a href="grfsnd.html#sndwithgtk" onmouseout="UnTip()" onmouseover="Tip('Gtk extensions from xg.c')">Snd and Gtk</a>
<li><a href="grfsnd.html#sndwithnogui">Snd with no GUI</a>
<li><a href="grfsnd.html#sndandruby" onmouseout="UnTip()" onmouseover="Tip('Ruby is a scripting/extension language somewhat like Python')">Snd with Ruby</a>
<li><a href="grfsnd.html#sndandforth" onmouseout="UnTip()" onmouseover="Tip('Forth is a postfix extension language')">Snd with Forth</a>
<li><a href="grfsnd.html#sndands7" onmouseout="UnTip()" onmouseover="Tip('s7 is yet-another Scheme extension language')">Snd with s7</a>
- <li><a href="grfsnd.html#sndandguile" onmouseout="UnTip()" onmouseover="Tip('Guile is yet-another Scheme extension language')">Snd with Guile</a>
<li><a href="grfsnd.html#sndandladspa" onmouseout="UnTip()" onmouseover="Tip('This is a Linux-based sound-effects plugin system')">Snd and LADSPA plugins</a>
<li><a href="grfsnd.html#sndandalsa" onmouseout="UnTip()" onmouseover="Tip('This is the no-longer-very-new Linux audio library')">Snd and ALSA</a>
<li><a href="grfsnd.html#sndandjack" onmouseout="UnTip()" onmouseover="Tip('This is the Jack audio library')">Snd and Jack</a>
@@ -4908,10 +4906,9 @@ We can use <a href="sndscm.html#dlocsigdoc">dlocsig</a> in conjunction with mix
(beg (cadr vals))
(end (caddr vals)))
(run
- (lambda ()
- (do ((i beg (+ 1 i)))
- ((= i end))
- (<em class=red>dlocsig</em> dloc i (<a class=quiet href="#readsample" onmouseout="UnTip()" onmouseover="Tip(extsnd_readsample_tip)">read-sample</a> rd)))))))))
+ (do ((i beg (+ 1 i)))
+ ((= i end))
+ (<em class=red>dlocsig</em> dloc i (<a class=quiet href="#readsample" onmouseout="UnTip()" onmouseover="Tip(extsnd_readsample_tip)">read-sample</a> rd))))))))
;; now tmp-sound is the name of a temp sound file that moves 'file' in a spiral
@@ -5616,7 +5613,7 @@ See popup.scm for an example.
<table border=0 cellpadding=5 vspace=10><tr><td><pre>
(define (brksnd dur base)
"(brksnd dur base) divides the current sound into dur-sized pieces,
-saving them in files named 'base'.n: (brksnd 1.0 \"sec\")"
+ saving them in files named 'base'.n: (brksnd 1.0 \"sec\")"
(let ((hop (inexact-&gt;exact (* (<a class=quiet href="#srate" onmouseout="UnTip()" onmouseover="Tip(extsnd_srate_tip)">srate</a>) dur)))
(len (<a class=quiet href="#frames" onmouseout="UnTip()" onmouseover="Tip(extsnd_frames_tip)">frames</a>))
(old-sync (<a class=quiet href="#sync" onmouseout="UnTip()" onmouseover="Tip(extsnd_sync_tip)">sync</a>)))
@@ -8429,20 +8426,23 @@ This returns the position (in samples) of right edge of the time domain waveform
<tr><td colspan=2 bgcolor="#f2f4ff">
<code><a class=def name="run">run</a> thunk</code>
</td></tr><tr><td></td><td>
-run is the Snd equivalent of the CL/CLM run macro. You can wrap it around a numerically-intensive
+<p>run is the Snd equivalent of the CL/CLM run macro. You can wrap it around a numerically-intensive
block of code, and the result will usually run 10 to 20 times faster. In the context of <a href="sndscm.html#wsdoc">with-sound</a>, run is used
to speed up instrument bodies. My timing tests indicate that Snd+Run instruments are within a factor of two to four
of the speed of CL+run+C in CLM. Currently, only s7 supports this optimization.
-
+</p>
<table border=0 cellpadding=5 vspace=10><tr><td><pre>
(define (ws-sine freq)
(let ((o (<a class=quiet href="sndclm.html#make-oscil" onmouseout="UnTip()" onmouseover="Tip(sndclm_make_oscil_tip)">make-oscil</a> freq)))
(<em class=red>run</em>
- (lambda ()
- (do ((i 0 (+ 1 i)))
- ((= i 100))
- (<a class=quiet href="sndclm.html#outa" onmouseout="UnTip()" onmouseover="Tip(sndclm_outa_tip)">outa</a> i (<a class=quiet href="sndclm.html#oscil" onmouseout="UnTip()" onmouseover="Tip(sndclm_oscil_tip)">oscil</a> o)))))))
-</pre></td></tr></table>
+ (do ((i 0 (+ 1 i)))
+ ((= i 100))
+ (<a class=quiet href="sndclm.html#outa" onmouseout="UnTip()" onmouseover="Tip(sndclm_outa_tip)">outa</a> i (<a class=quiet href="sndclm.html#oscil" onmouseout="UnTip()" onmouseover="Tip(sndclm_oscil_tip)">oscil</a> o))))))
+</pre>
+<p>In the past, the argument to run had to be a "thunk", a procedure of no arguments;
+this style of use is still supported.
+</p>
+</td></tr></table>
<A NAME="declare"></A>
Functions embedded within run may need to declare the type of their arguments; run assumes each variable has one type (integer by default) throughout its life.
@@ -8450,14 +8450,14 @@ So, the following code
displays "0", rather than "3.14":
<pre>
- (run (lambda () (let ((x 3.14)) (define (a b) (display b)) (a x))))
+ (run (let ((x 3.14)) (define (a b) (display b)) (a x)))
</pre>
The "b" argument to "a" is assumed to be an integer, and passing in a float
causes nothing but confusion. To get this code to work right:
<pre>
- (run (lambda () (let ((x 3.14)) (define (a b) (<em class=red>declare</em> (b real)) (display b)) (a x))))
+ (run (let ((x 3.14)) (define (a b) (<em class=red>declare</em> (b real)) (display b)) (a x)))
</pre>
The current declarable types include any <a href="sndscm.html#def-clm-struct">def-clm-struct</a> type and:
@@ -8864,12 +8864,12 @@ it's probably simpler to use <a href="sndscm.html#withsound">with-sound</a> (see
(s (<a class=quiet href="sndclm.html#make-src" onmouseout="UnTip()" onmouseover="Tip(sndclm_make_src_tip)">make-src</a> :srate 0.0))
(incr (+ 2.0 (<a class=quiet href="sndclm.html#oscil" onmouseout="UnTip()" onmouseover="Tip(sndclm_oscil_tip)">oscil</a> o)))
(tempfile (<em class=red>with-sound</em> (:output (<a class=quiet href="#sndtempnam" onmouseout="UnTip()" onmouseover="Tip(extsnd_sndtempnam_tip)">snd-tempnam</a>) :srate (<a class=quiet href="#srate" onmouseout="UnTip()" onmouseover="Tip(extsnd_srate_tip)">srate</a>) :to-snd #f)
- (<a class=quiet href="sndscm.html#run" onmouseout="UnTip()" onmouseover="Tip(sndscm_run_tip)">run</a> (lambda ()
- (do ((samp 0 (+ 1 samp)))
- ((or (c-g?) (<a class=quiet href="#sampleratendQ" onmouseout="UnTip()" onmouseover="Tip(extsnd_sampleratendQ_tip)">sampler-at-end?</a> rd)))
- (<a class=quiet href="sndclm.html#out-any" onmouseout="UnTip()" onmouseover="Tip(sndclm_out_any_tip)">out-any</a> samp (<a class=quiet href="sndclm.html#src" onmouseout="UnTip()" onmouseover="Tip(sndclm_src_tip)">src</a> s incr (lambda (dir) (<a class=quiet href="#readsample" onmouseout="UnTip()" onmouseover="Tip(extsnd_readsample_tip)">read-sample</a> rd))) 0)
- (if (= (modulo samp 2205) 0)
- (set! incr (+ 2.0 (<a class=quiet href="sndclm.html#oscil" onmouseout="UnTip()" onmouseover="Tip(sndclm_oscil_tip)">oscil</a> o)))))))))
+ (<a class=quiet href="#run">run</a>
+ (do ((samp 0 (+ 1 samp)))
+ ((or (c-g?) (<a class=quiet href="#sampleratendQ" onmouseout="UnTip()" onmouseover="Tip(extsnd_sampleratendQ_tip)">sampler-at-end?</a> rd)))
+ (<a class=quiet href="sndclm.html#out-any" onmouseout="UnTip()" onmouseover="Tip(sndclm_out_any_tip)">out-any</a> samp (<a class=quiet href="sndclm.html#src" onmouseout="UnTip()" onmouseover="Tip(sndclm_src_tip)">src</a> s incr (lambda (dir) (<a class=quiet href="#readsample" onmouseout="UnTip()" onmouseover="Tip(extsnd_readsample_tip)">read-sample</a> rd))) 0)
+ (if (= (modulo samp 2205) 0)
+ (set! incr (+ 2.0 (<a class=quiet href="sndclm.html#oscil" onmouseout="UnTip()" onmouseover="Tip(sndclm_oscil_tip)">oscil</a> o))))))))
(len (<a class=quiet href="#mussoundframes" onmouseout="UnTip()" onmouseover="Tip(extsnd_mussoundframes_tip)">mus-sound-frames</a> tempfile)))
(<em class=red>set-samples</em> 0 (- len 1) tempfile #f #f #t "step-src" 0 #f #t)))
</pre></td></tr></table>