[CM] [Snd] Guile newbie help?

vze26m98 vze26m98@optonline.net
Sun, 04 Mar 2007 22:47:53 -0500


Ralf Mattes wrote on 3/4/07 at 9:21 PM

>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
>"next" ...

Here's a slightly revised version then:

(while (not (sample-reader-at-end? rdr))
       (set! current (next-sample rdr))
       (set! sum (+ sum (- current prev)))
       (set! prev current))

>So, iff i understand correctly, your code sums up the difference
>between all samples. Isn't that supposed to 0.0?

Hi Ralf-

Well, I'm trying to sum the difference between the current sample and
the previous sample. I don't think this sums to zero, but I could be
really wrong. :-)

I did the following calc:

 prev    current   diff
   0.0 - -0.439 =  0.438
-0.439 - -0.224 = -0.215
-0.224 -  0.141 = -0.365
 0.141 -  0.449 = -0.308
 0.449 -  0.512 = -0.063
 0.512 - -0.318 =  0.830
-0.318 -  0.087 = -0.405
 0.087 -  0.436 = -0.349
 
                  -0.437 sum
 
 (I hope my math is sufficiently correct. I don't have access to a
spreadsheet)

The above isn't a complete thought, but what I'm hoping to get is a
rough number that would distinguish between 50 samples of white noise
and 50 samples that don't get above +-0.0005 in amplitude.

I'd like to use the number to label sound files. It isn't some synthesis
process.

Hope the above is clear, or maybe it's clear I've got some bolts
loose...

In any event, thanks for entertaining my problem!

Best, Charles

<vze26m98@optonline.net>