[CM] [Snd] Guile newbie help?
Mon, 05 Mar 2007 03:21:41 +0100
On Sun, 2007-03-04 at 20:25 -0500, vze26m98 wrote:
> OK, in spite of all the many useful examples in the distribution and
> some reading of the Guile documents, this dummy can't get the following
> to work in the listener:
> (assuming a ">" prompt)
> >(define next 0)
> >(define prev 0)
> >(define sum 0)
> >(define rdr (make-sample-reader 0))
> >(while (not (sample-reader-at-end? rdr)) (set! next (rdr)) (set! sum (+
> sum (- next prev))) (set! prev next))
> ...or in a more readable form:
> (while (not (sample-reader-at-end? rdr))
> (set! next (rdr))
> (set! sum (+ sum (- next prev)))
> (set! prev next))
> I can take all these statements out of the while loop and I believe they
> work correctly (or give results other than 0.0).
Could you elaborate a little bit more _what_ you want to do?
Is this really copied code? What's "(rdr)" supposed to return -
shouldn't this be "(read-sample rdr)"?
BTW, i prefer more "speaking" names, like "current" where you use
So, iff i understand correctly, your code sums up the difference between
all samples. Isn't that supposed to 0.0?
Cheers, Ralf Mattes
> Thanks, Charles
> Cmdist mailing list