[futurebasic] Re: setSoundLevel

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 1998 : Group Archive : Group : All Groups

From: Paul Bruneau <paul_bruneau@...>
Date: Mon, 27 Jul 1998 15:30:55 -0400
Lucy24@... wrote:
> >>That method of changing the volume was "obsoleted" some time back by
> Apple, when they changed the sound hardware on Macs. I think it'll lock
> up on _any_ PowerMac.<<
> Ah, well, that _would_ explain it. In case you wondered, my alternative
> approach (the situation involves a sound-intensive game and an optional
> "earplugs" object) goes like so:
> ...regular soundPlay code down to getting snd resource
>       sndsize& = FN SIZERESOURCE(gameSound&)
>       sndlength& = sndsize&/11
>       DELAY sndlength&
>  I can do this because all my sounds are sampled at 11K, i.e. 11K of resource
> = 1 sec of playing time. (I've never figured out whether this is _literally_
> what the term "sampling rate" means or if it just comes out that way.)

It works out this way because you must be using 8-bit sounds. This means that
each sample can be a value from 0-255 (or from -128 to 128, you know what I mean).

These samples are taken (or played) 11k times per second. So, that's one byte
of data times 11k per second = 11Kbytes per second. That's what sample rate
is: How many times per second I take a sample.

If you were using 16-bit sound where each sample can be 0-65535 (like CDs do),
then you'd see twice as much memory used per second. I highly suggest it. 16
bit sounds are very nice. You still wouldn't have CD quality sound, of course,
because CDs sample 44K times per second, but in my experience, it's still
worth it.

"Audiophiles" think that 16-bit isn't good enough, of course, because they are
fools, but that's a story for another time. They also think brown speaker
grilles sound "warmer" than blue ones. Fact.