<!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> </DIV>
<DIV><FONT>I guess the obvious question here, to both Kjetil S. Matheussen and
Bill Schottstaedt, is "Which processor and clock speed are you
using?"</FONT></DIV>
<DIV> </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 any given software is going to
perform.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </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> </DIV>
<DIV><FONT face=Arial size=2></FONT> </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" <</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>><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>> On Mon, 2007-10-15 at 15:22
-0700, Bill Schottstaedt wrote:<BR>>>> On a very recent Intel laptop
running a Core Duo at 2.4GHz (I think<BR>>>> that's the speed),
SuperCollider would do 500 interpolated sine<BR>>>> oscillators with a
(roughly) 50% cpu load (in one of the cores).<BR>>><BR>>> In the
Scheme version of Snd, at 44100 KHz, I get about 180 such<BR>>> sines
(actually, I'm calling the sin function, not interpolating some<BR>>>
table):<BR>>><BR>>> (with-sound (:statistics
#t)<BR>>> (let ((gens (make-vector
180)))<BR>>> (do ((i 0 (1+
i)))<BR>>> ((= i
180))<BR>>> (vector-set! gens i
(make-oscil (* 10 (1+ i)) (random (* 2
pi)))))<BR>>>
(run<BR>>> (lambda
()<BR>>> (do ((i 0 (1+
i)))<BR>>>
((= i 44100))<BR>>>
(let ((sum
0.0))<BR>>>
(do ((k 0 (1+
k)))<BR>>>
((= k
180))<BR>>>
(set! sum (+ sum (oscil (vector-ref gens
k)))))<BR>>>
(outa i (* .01 sum) *output*)))))))<BR>>><BR>>>
;test.snd:<BR>>> maxamp: 0.2935<BR>>>
compute time: 1.020<BR>><BR>> Wow, that's impressive. 180 directly from
scheme...<BR>> I never tried Kjetil's realtime snd, that would (presumable)
be faster?<BR>><BR><BR><BR>Just tried. And yes, its about twice as
fast:<BR><BR>(let* ((num 130)<BR>
(gens (make-vector num)))<BR> (do ((i 0 (1+
i)))<BR> ((= i
num))<BR> (vector-set! gens i (make-oscil (* 10 (1+ i))
(random (* 2 pi)))))<BR> (set! (rt-safety) 0)<BR>
(<rt-play> 0 10<BR> (lambda
()<BR> (let ((sum 0.0))<BR> (do
((k 0 (1+ k)))<BR> ((= k num))<BR>
(set! sum (+ sum (oscil (vector-ref gens k)))))<BR> (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> while (!((rt_globals->k__2 ==
rt_globals->num__4))) {<BR> (rt_globals->sum__1 =<BR>
(rt_globals->sum__1 +<BR> mus_oscil(XEN_TO_MUS_ANY<BR>
(SCM_VECTOR_REF<BR>
(rt_globals->gens__5, ((int) rt_globals->k__2))), 0,<BR>
0)), rt_globals->k__2 = (1 +
rt_globals->k__2)<BR> );<BR>
};<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>