[CM] sound-maxamp?

Bill Schottstaedt bil@ccrma.Stanford.EDU
Mon, 28 Apr 2003 04:41:25 -0700


> Perhaps someone can explain how sound-maxamp should be used in clm-2.

(defvar maxes (make-integer-array (* 2 chans)))
(sound-maxamp filename maxes)

the maxamp is the second of the 2 vals, the sample number the first.
The C code is mus_sound_maxamp in sound.c, used by the with-sound
statistics printer in print-statistics in io.lisp. This is a
wrapper around the real code to try to acoomodate the mismatch
between Lisp and C in types.  The maxamp is a 24-bit int,
so you need to call fix-to-real to turn it into a float in Lisp.
Your code example was correct:

> ? (sound-max-maxamp "signals:foo.aiff")
> #(43065 5872025)

This is saying the maxamp occurred at sample 43065 and had the
value (clm::fix-to-real 5872025) which is 0.7.  I'll expand
the documentation (this wasn't well-documented because it is
obviously broken).