<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1601" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2><FONT face="Times New Roman" 
size=3></FONT></FONT>&nbsp;</DIV>
<DIV><FONT>I guess the obvious question here, to both Kjetil S. Matheussen and 
Bill Schottstaedt,&nbsp;is "Which processor and clock speed are you 
using?"</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>Although I don't yet understand the syntax you are all using, I don't think 
the </DIV>
<DIV><FONT>44100 KHz referred to below, has anything to do with the above, which 
will largely dictate how well&nbsp;any given&nbsp;software is going to 
perform.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV>Also, while I am still awaiting the machinery, any advice on where I should 
start for getting to grips with this syntax?</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><FONT face="Times New Roman" size=3>Date: Tue, 16 
Oct 2007 21:41:34 +0200 (CEST)<BR>From: "Kjetil S. Matheussen" &lt;</FONT><A 
href="mailto:kjetil.matheussen@notam02.no"><FONT face="Times New Roman" 
size=3>kjetil.matheussen@notam02.no</FONT></A><FONT face="Times New Roman" 
size=3>&gt;<BR>To: </FONT><A href="mailto:planetccrma@ccrma.Stanford.EDU"><FONT 
face="Times New Roman" size=3>planetccrma@ccrma.Stanford.EDU</FONT></A><BR><FONT 
face="Times New Roman" size=3>cc: </FONT><A 
href="mailto:nando@ccrma.Stanford.EDU"><FONT face="Times New Roman" 
size=3>nando@ccrma.Stanford.EDU</FONT></A><FONT face="Times New Roman" size=3>, 
</FONT><A href="mailto:bil@ccrma.Stanford.EDU"><FONT face="Times New Roman" 
size=3>bil@ccrma.Stanford.EDU</FONT></A><BR><FONT face="Times New Roman" 
size=3>Subject: [PlanetCCRMA] Re: Re: sine waves in real 
time<BR><BR><BR>Fernando Lopez-Lezcano:<BR>&gt; On Mon, 2007-10-15 at 15:22 
-0700, Bill Schottstaedt wrote:<BR>&gt;&gt;&gt; On a very recent Intel laptop 
running a Core Duo at 2.4GHz (I think<BR>&gt;&gt;&gt; that's the speed), 
SuperCollider would do 500 interpolated sine<BR>&gt;&gt;&gt; oscillators with a 
(roughly) 50% cpu load (in one of the cores).<BR>&gt;&gt;<BR>&gt;&gt; In the 
Scheme version of Snd, at 44100 KHz, I get about 180 such<BR>&gt;&gt; sines 
(actually, I'm calling the sin function, not interpolating some<BR>&gt;&gt; 
table):<BR>&gt;&gt;<BR>&gt;&gt; (with-sound (:statistics 
#t)<BR>&gt;&gt;&nbsp;&nbsp; (let ((gens (make-vector 
180)))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; (do ((i 0 (1+ 
i)))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= i 
180))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (vector-set! gens i 
(make-oscil (* 10 (1+ i)) (random (* 2 
pi)))))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp; 
(run<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (lambda 
()<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (do ((i 0 (1+ 
i)))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
((= i 44100))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(let ((sum 
0.0))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(do ((k 0 (1+ 
k)))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
((= k 
180))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(set! sum (+ sum (oscil (vector-ref gens 
k)))))<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(outa i (* .01 sum) *output*)))))))<BR>&gt;&gt;<BR>&gt;&gt; 
;test.snd:<BR>&gt;&gt;&nbsp;&nbsp; maxamp: 0.2935<BR>&gt;&gt;&nbsp;&nbsp; 
compute time: 1.020<BR>&gt;<BR>&gt; Wow, that's impressive. 180 directly from 
scheme...<BR>&gt; I never tried Kjetil's realtime snd, that would (presumable) 
be faster?<BR>&gt;<BR><BR><BR>Just tried. And yes, its about twice as 
fast:<BR><BR>(let* ((num 130)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
(gens (make-vector num)))<BR>&nbsp;&nbsp; (do ((i 0 (1+ 
i)))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((= i 
num))<BR>&nbsp;&nbsp;&nbsp;&nbsp; (vector-set! gens i (make-oscil (* 10 (1+ i)) 
(random (* 2 pi)))))<BR>&nbsp;&nbsp; (set! (rt-safety) 0)<BR>&nbsp;&nbsp; 
(&lt;rt-play&gt; 0 10<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (lambda 
()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (let ((sum 0.0))<BR>&nbsp; (do 
((k 0 (1+ k)))<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; ((= k num))<BR>&nbsp; 
&nbsp;&nbsp; (set! sum (+ sum (oscil (vector-ref gens k)))))<BR>&nbsp; (out (* 
.01 sum))))))<BR><BR><BR>Here's the generated c-code for the inner 
loop:<BR><BR>static void rt_gen1__3(struct RT_Globals 
*rt_globals)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp; while (!((rt_globals-&gt;k__2 == 
rt_globals-&gt;num__4))) {<BR>&nbsp; (rt_globals-&gt;sum__1 =<BR>&nbsp; 
(rt_globals-&gt;sum__1 +<BR>&nbsp; &nbsp; mus_oscil(XEN_TO_MUS_ANY<BR>&nbsp; 
&nbsp;&nbsp;&nbsp; (SCM_VECTOR_REF<BR>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 
(rt_globals-&gt;gens__5, ((int) rt_globals-&gt;k__2))), 0,<BR>&nbsp; 
&nbsp;&nbsp;&nbsp; 0)), rt_globals-&gt;k__2 = (1 + 
rt_globals-&gt;k__2)<BR>&nbsp; &nbsp;&nbsp;&nbsp; );<BR>&nbsp;&nbsp;&nbsp;&nbsp; 
};<BR>}<BR><BR>Its not quite optimal, but still I'm pretty<BR>sure most of the 
time is spent in mus_oscil.<BR><BR>So I'm also pretty sure the oscillator 
generator in supercollider is super 
<BR>fast.</FONT><BR><BR></DIV></FONT></BODY></HTML>