[net.micro.mac] Make my Mac talk with no POPs

matt@srs.UUCP (Matt Goheen) (12/04/85)

    Has anyone tried to use the D/A converter on the Mac using PBWrite
to the sound driver in Free-Form mode?  I have it working fine but
I get a nasty "pop" at the end of every sound UNLESS the length of
the record is a mutiple of 1K.  Is this a bug in the Sound Driver?
Is this a bug in the Device Manager?

This can be really bad for the application I am working on where you
can select small portions of a waveform to play over the Macs speaker.
If the size is small, the resulting sound can be very short and the
"pop" at the end makes it difficult/impossible to understand what the
actual sound was.  Currently, I have to make the blocks in increments
of 1K and zero out the remainder of the block.  This works but is
rather ugly and inefficient when I have a whole continuous sound that
I have to break up and move around just to run it through the DA
converter.  Any help would be appreciated...

					Matt Goheen
					S.R. Systems
			    ...{seismo,allegra}!rochester!srs!matt

shulman@topaz.RUTGERS.EDU (Jeff Shulman) (12/07/85)

See Macintosh Technical Note #19: How to Produce Continuous Sound Without
"Clicking".  Soon to be available at a site near you.....


							Jeff

uucp:   ...{harvard, seismo, ut-sally, sri-iu, ihnp4!packard}!topaz!shulman
arpa:   SHULMAN@RUTGERS
CIS:    76136,667
Delphi: JEFFS

matt@srs.UUCP (Matt Goheen) (12/10/85)

> See Macintosh Technical Note #19: How to Produce Continuous Sound Without
> "Clicking".  Soon to be available at a site near you.....

    I've had a few people respond with pointers to the mysterious
Technical Note #19, however, I have not been able to get ahold of it
(USENET is my ONLY net contact to the Mac world).  Furthermore, I
don't think it is exactly what I'm looking for.  Perhaps I should
try to make my problem a bit clearer.

    I am trying to play SHORT pieces of a long waveform.  I get the
POP when ever I play (write) any record that is NOT a multiple of 1K.
I don't have the IM manuals here, but the sequence is something like
this:

	1) Set up the FFrec with the ratio (for the DA rate) and the
	   mode (FFMode - free form mode).  Follow these values with
	   the actual sound data.
	2) Set up the ParamBlkRec for the PBWrite call (I'm not using
	   the sound routines because I started working on this before
	   Aztec C supported them, I suppose I could change now but
	   seeing as the sound routines for Aztec just call PBWrite,
	   I don't see that it's really necessary).  This means
	   making ioBuffer point to the FFrec and setting ioReqCount
	   to the number of values to play (write).

    In case anyone needs more info, I am using a data rate of about
13 samples/ms.  My current fix is to round the record length to the
nearest 1K interval (up), save the extra data in a temporary buffer,
zero to the end of the 1K block, play the damn thing and finally,
copy the saved stuff back.  If anyone wants a code fragment to solve
this just ask (I'd put in now if I had it here, it is kind of involved).

    If ioReqCount is not a multiple of 1K, you get a nasty POP at the
end of the sound.  I am NOT producing CONTINUOUS sound, only a short
burst.  Uggh.

    Well, that better explains it at least...thanks to those who tried
to help...


					    Matt Goheen
					    S.R. Systems
				...!{seismo,allegra}!rochester!srs!matt