Microsoft KB Archive/72680

= BUG: No Sound Using SOUND Statement in Compiled Pgm on Mac LC =

Article ID: 72680

Article Last Modified on 11/21/2006



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 &quot;Press any key to continue&quot; WHILE INKEY$=&quot;&quot;: 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 &quot;Press any key to continue&quot; WHILE INKEY$=&quot;&quot;: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 &quot;Press any key to continue&quot; WHILE INKEY$ = &quot;&quot;: WEND END

Additional query words: MQuickB 1.00 1.00a 1.00b

Keywords: kbbug KB72680

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.