BUG: No Sound Using SOUND Statement in Compiled Pgm on Mac LC (72680)






This article was previously published under Q72680

SYMPTOMS

Using QuickBasic's SOUND statement in a compiled program on a Macintosh LC computer fails to generate any sound. However, when the program is run in QuickBasic's interpreter, the correct sound is produced.

To work around the problem, use the WAVE statement (such as WAVE 0,SIN) before any SOUND statements in the program.

Microsoft has confirmed this to be a bug in Microsoft QuickBasic versions 1.0, 1.0a, and 1.0b for the Macintosh . We are researching the problem and will post new information here as it becomes available.

MORE INFORMATION

When the following code sample is compiled and run on a Mac LC, no sound is produced:
SOUND 1046, 18.2, 130, 0         'Play a C note for 1 second
PRINT "Press any key to continue"
WHILE INKEY$="": WEND
END
				
The workaround to the problem is to add a WAVE 0, SIN statement before the SOUND statement. The following code example works correctly when run from the interpreter or as a compiled program on the Macintosh LC:
WAVE 0, SIN
SOUND 1046, 18.2, 130, 0
PRINT "Press any key to continue"
WHILE INKEY$="":WEND
END
				
Using WAVE 0, SIN diminishes volume considerably and since this command puts the system in multi-voice mode, the volume cannot be controlled with the SOUND statement.

An alternative to WAVE 0, SIN that produces louder sound is to define a square wave. Do this by defining an array of 256 integers with the first 128 elements set to 127 and the last 128 elements set to -128. Specify the array name as the second argument to the WAVE command.

The following code example produces a louder sound:
   DIM w%(255)
   FOR i = 0 to 127
      w%(i) = 127
   NEXT
   FOR i = 128 to 255
      w%(i) = -128
   NEXT
   WAVE 0, w%
   SOUND 1046,18.2
   PRINT "Press any key to continue"
   WHILE INKEY$ = "": WEND
   END
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: kbbug KB72680