[comp.sys.mac.hypercard] Turbo Pascal SOund XCMD

wsadler@silver.bacs.indiana.edu (william sadler) (11/05/89)

Greetings.  I recently modified a Turbo Pascal program that plays any
frequency with a square wave for use in a Hypercard stack as an XCMD.  This is
a portion of the "sound" program that comes with Turbo Pascal.  I needed a way
to play a wide assortment of frequencies, and this XCMD works just fine.
There is one problem, however.  In order to get the Turbo Pascal script to work
I had to use more than one massage handler and I also could not pass them
immediately after use.  So, the stack works fine unless you quit Hypercard then
try to restart the stack again without re-booting the system.  It then crashes,
presumably because of the message handlers in the XCMD.

I am a novice programmer in Pascal and I really don't know a way around this.
Would anyone out there have any ideas?  Or, if you know an easier way to get
Hypercard to play specific frequencies?  The hypercard sound command is really
frustating to use since it only allows you 12 pitches and even then varies them 
from machine to machine.  For instance this stack runs pretty well on an SE, with
no distortion of the sound and a duration of about 2 seconds.  On my Mac II it
has a duration of about 4 seconds but with no distortion.  On my IIx it is so
loud it distorts and the duration is even longer.  This is all with the same
XCMD.  All I can assume is that system changes in the machines have altered the
wya the sound tool works.

Thanks in advance
Will Sadler
sadler@iubacs.bitnet or wsadler@silver.bacs.indiana.edu