[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How is the IIgs beep generated?



Mitchell Spector wrote:
"Michael J. Mahon" <mjmahon@aol.com> wrote:


Mitchell Spector wrote:

"Michael J. Mahon" <mjmahon@aol.com> wrote:

The correct parameters for the default IIgs "bonk" are:

POKE 6,83
POKE 7,2
CALL 768

That reproduces it quite well.  The volume is about 2/3 the max
volume of a raw beep, but the ear doesn't really care.  ;-)

   It's a similar approximation of the GS "bonk" bell (especially
the lower tones), but certainly not the same. :)

Try POKEing the parameters I suggested and give it a listen.


    Not sure if this is what you're suggesting, but here's what I did:

-Loaded your "Test.bonk" program into memory and ran it once
-Typed in 'CALL 768' and heard one tone only
-Typed in POKE 6,83 <return>, POKE 7,2 <return>
-Typed in 'CALL 768' once again, heard a lower tone this time

That's it!

After listening to them side by side, I'll bet it's the best
approximation that can be produced with Apple II hardware.


    It's closer in pitch, but still not the very unique IIgs "bonk".
Using the different parameters (assuming I used them correctly)
got something closer, but still not exact.

I had a IIgs and my //e side by side and put each into a loop
doing the IIgs "native" bonk and my //e bonk about once a second.
I adjusted the parameters to get the closest match, and it seemed
right in pitch, duration, and envelope.

If both waveforms are squarewaves with linearly diminishing
amplitudes, that should do it.

Is the IIgs volume control non-linear?  That is, is volume 14 twice
the amplitude of volume 7?  It's possible that the IIgs volume control
is a non-linear pot, but unusual.

I'm still curious how the tone is produced. Maybe it's standard speaker toggling that is then filtered or enhanced somehow using
something unique to the GS's audio circurity?

The IIgs routine uses completely standard speaker toggling, combined
with linear decreases in speaker volume throughout the tone--which
only the IIgs hardware supports.

My routine does exactly the same thing, based on 21.3kHz pulse-width-
modulation.  Many people (particularly those "of an age" ;-) cannot
hear the 21.3kHz pulses at all, but only the modulation, which is at
the "bonk" frequency.  Ideally, one would use a low-pass filter to
remove all traces of the 21.3kHz "carrier", but we're trying to use
standard hardware...

I'm guessing that the primary difference is that on the IIgs, the
speaker is driven by an audio amplifier from the actual speaker toggle
logic level, while on all other Apple II's, the speaker is driven by
a Darlington driver with a peculiar AC-coupled, DC-clamped input.


    Ahh. If that's the case, then the "bonk" sound on Apple IIGS,
through which ever method or means it is produced, is unique to the IIGS and cannot be reproduced identically on an 8-bit Apple II.

I haven't done the experiment, but I suspect that using ultrasonic
PWM prevents the "standard" Apple II sound from being affected much
by the coupling circuit.  This might justify some 'scope observations
as well as comparative listening tests (for different ways of producing
squarewave sounds on a //e).

The most unusual feature of the IIgs is a program-controlled volume
control on the speaker.  This can be used to greatly increase the
dynamic range of sounds while still preserving PWM signal to noise
ratio.

    Which brings up something interesting that I've always thought
about. It seems like there's this untapped sound capability on the
IIGS which is neither emulated Apple II speaker toggling OR the Ensoniq synthesizer. Call it enhanced speaker toggling if you will. :)
Apart from the system bell, I've never seen a single programmer
experiment or use this sound feature in any piece of software.

I've seen speaker toggling used in native IIGS software for audio (e.g. Paperboy, Gauntlet, John Madden's Football) but is it just old fashioned 8-bit Apple II sound. I wonder if some kind of simple music program could be written that could use it...just for the sake of seeing if it could be done. The most simple thing to try would be to play any of the Control Panel bell pitches at will, like a piano keyboard! This would be running on a IIgs of course, we're talking
about just playing the pitches in the Sound Control Panel.

Check out RT.SYNTH.  It doesn't (yet?) include a damped squarewave,
but that would be a trivial addition--with any envelope.  (Of course,
it's still 5-bit samples.)

If a damped squarewave was all that was desired, then the native IIgs
bonk routine approach (see Jerry's post) could be used, though it would
take significant re-work to get accurate musical notes.

-michael

NadaNet and AppleCrate II: parallel computing for Apple II computers!
Home page: http://home.comcast.net/~mjmahon

"The wastebasket is our most important design
tool--and it's seriously underused."