[comp.sys.mac.programmer] Sound Manager vs. Sound Driver

oster@dewey.soe.berkeley.edu (David Phillip Oster) (12/26/89)

I just got through re-implementing the phone dialer
module of an application. In the process, I've butted
my head against the wall of the Sound Manager, and I'm
using this soap box to complain.

When you send phone dialing tones to the speaker, you
send a pair of frequencies. There are two basic techniques
for doing that:
1.) sampled sound: Just digitize the tone you want from a
real phone. I didn't want to use this one for a number of
reasons, not least is the amount of space the samples take
up.

2.) the 4-voice wave table synthesizer. Clean and simple.

Now, there are 2 ways to use the 4-voice wave table synthesizer:
Sound Driver (the old way, documented in Inside Mac Vol II)
&
Sound Manager (the new way, documented in Inside Mac Vol V., but
	that documentation has been superceded by a new chapter which
	is on Phil & Dave's Excellent CD.)

The Sound Manager documentation says, "The older Sound Driver should
no longer be used. The Sound Manager is its replacement, providing
all of its predecessor's abilities and more. ... Support for the older
Sound Driver may eventually be discontinued."

That's pretty clear. So, I set out to write my code using Sound Manager.
Then I read a little further. I discovered the Sound Manager version of
the 4-voice wave table synthesizer:
		1.) doesn't work at all in the Plus or SE
		2.) has a bug in the channel synchronization command that 
			requires a funky, version dependent work around.
		3.) does not define how one sets the frequencies
			appropriately to produce anything other than an
			official "note".  In particular, there is no
			documentation on producing the wierd frequencies a
			phone dialer needs.

I sat down and wrote the thing in Sound Driver in about an hour.

The whole experience left a bad taste. Apple, it isn't enough for you
to tell me that a new manager is better than an old one. The new manager
must _actually_be_ better than the old one. Change the code, or change the
documentation, but the current situation is ridiculous.

By the way, my telephone documentation doesn't say what wave shape the
phone company recommends. I've been using a sine wave, but possibly a 
triangle or a sawtooth would work better. Can anyone give me a hint?


> The mac is a detour in the inevitable march of mediocre computers.
> drs@bnlux0.bnl.gov (David R. Stampf)
--- David Phillip Oster          -master of the ad hoc odd hack. 
Arpa: oster@dewey.soe.berkeley.edu 
Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu 

jmunkki@kampi.hut.fi (Juri Munkki) (12/27/89)

In article <33381@ucbvax.BERKELEY.EDU> oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) writes:
>The whole experience left a bad taste. Apple, it isn't enough for you
>to tell me that a new manager is better than an old one. The new manager
>must _actually_be_ better than the old one. Change the code, or change the
>documentation, but the current situation is ridiculous.

I agree. I also think that since all the ads say that the ASC is capable of
sampled stereo sound, the sound manager should be able to generate stereo
sound. It looks like the sound manager was written with music in mind and
not to control the existing hardware.

Another thing: The Macintosh Family Hardware Reference should be renamed
to "Macintosh Hardware Introduction for: Plus, SE, II". I assumed that it
would have contained enough information for me to control the video card
and sound hardware, but it read like all the advertisements, telling me
what the hardware is capable of, but not telling me how to use it.

I know accessing the hardware directly is not generally a good thing to do,
but sometimes it's the only way and sometimes it's a better way. Sometimes
it's best to let the user decide whether to access the hardware directly or
use a software method. If I wrote something that accesses the sound chip
directly, I would also make it an extra feature so that you have to check
a box or make a selection to enable that feature. Also look at what AFT
does to ensure compatibility with exotic video cards: it allows you to use
QuickDraw for animation instead of writing directly.

_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
|     Juri Munkki jmunkki@hut.fi  jmunkki@fingate.bitnet        I Want   Ne   |
|     Helsinki University of Technology Computing Centre        My Own   XT   |
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^

oster@dewey.soe.berkeley.edu (David Phillip Oster) (12/27/89)

More adventures: My dialer routine worked fine on the IIcx, but when I
tried it on the plus, it would not dial correctly dial any number with a
'4' in it. So, I took a look at what Hypercard is doing:

1.) It uses sine waves.
2.) It uses slightly different frequencies than I calculated.
3.) It uses the old sound driver for its "dial" command and not the new
	Sound Manager, even though the Sound Manager documentation
	specifically says not to mix the old and new calls.
4.) It also does not dial correctly dial any number with a '4' in it on
	my MacPlus.
5.) It completely ignores Tech Note 19's guidelines on supressing clicking
in sound. But then, I gave a careful listen to the telephone I use every
day. The telephone clicks at the end of each tone too.

--- David Phillip Oster            --  No, I come from Boston. I just work
Arpa: oster@dewey.soe.berkeley.edu --  in cyberspace.
Uucp: {uwvax,decvax}!ucbvax!oster%dewey.soe.berkeley.edu