# [CM] Snd-8(.5) questions (newbie)

Bill Schottstaedt bil@ccrma.Stanford.EDU
Mon, 16 Oct 2006 12:54:25 -0700

```> 1a. How can I get the "mean/average" value of all samples?

(let ((sum 0.0))
(scan-channel (lambda (y) (set! sum (+ sum y)) #f))
(/ sum (frames)))

> 1b. How can I get the "mean/average" value of "selected" samples?

(let ((sum 0.0))
(scan-channel (lambda (y) (set! sum (+ sum y)) #f)
(selection-position) (selection-frames))
(/ sum (selection-frames)))

> 2a. How can I get the "mean/average" value of the "amplitude" for all
>   samples?

There's no distinction between a sample and its amplitude.

> 3a. How can I get the "RMS" value for all samples?
> 3b. How can I get the "RMS" value for "selected" samples?

similar to above but return RMS.

> 4a. How can I get the "standard deviation" value for all samples?
> 4b. How can I get the "standard deviation" value for "selected" samples?

similar to above, but return standard deviation.

> 5a. How can I get the "min" and "max" values of all samples?
> 5b. How can I get the "min" and "max" values of "selected" samples?

maxamp and selection-maxamp

> (In case of 5.a and 5.b also getting the "sample number" would be nice, or
> maybe one could afterwards "search" for samples of a given "value" using
> the "find-channel" function, for example?)

maxamp-position and selection-maxamp-position

> 6.a How can I "add/subtract" a value to/from all samples?
>    (I believe I have found the answer to 6.a ... "offset-channel".)
> 6.b How can I "add/subtract" a value to/from "selected" samples?

(map-channel (lambda (y) (- y .1))) ; or whatever you want to subtract

> From these four "independent" mono tracks, I would like to produce a
> "stereo" file (2 channels).

see mono->stereo in extensions.scm

> In "professional live" recordings, you can
> actually "hear" that one guy is staying left to you, another one right to
> you, and so on ... and this is exactly what I would like to achieve, too.
> I would like to "hear" the Soprano most left, Alto left-middle, Tenor
> right-middle, Bass most right ...

perhaps place-sound is what you want.

```