Futurebasic/Language/Reference/sound frequency

Description
This statement plays a tone of the given pitch, duration and volume.

The  is expressed as a frequency in cycles per second. The frequency that you specify is converted to the nearest "MIDI note value," which determines the actual note that's played. Middle "C" corresponds to a frequency of 261.625.

The  is expressed in ticks, and can range from 0 to 32,767. However, the toolbox sound commands require FB to translate the ticks into an integer to represent half-milliseconds. This means you can play a note that is no longer than 32.8 seconds.

The  can range from 0 through 127. Specifying 0 will result in silence, and 127 will play the sound at the maximum volume specified in the "Sound" control panel. If you omit this parameter, it is treated as 127.

If  is , the sound will play asynchronously. If  is , or you omit the parameter, the sound plays synchronously. When you play asynchronously, your program starts executing the next statement immediately while the sound is playing in the background. When you play synchronously, the next statement in your program does not execute until the sound has finished playing.

If you are playing notes asynchronously, and your execute a second  statement while another sound is still playing in the background, the new sound won't start playing until the first sound finishes. Note that on some machines, this technique can result in lost sounds. When playing asynchronously it's better to use the  function to determine when one sound has ended, before attempting to play the next sound.

One way to play sound frequencies is to use negative numbers (from -1 through -127) to represent the note that you wish to play. The table below shows how to use these values.

Image was here

Using the midi table for a guideline, we can create a version of "pop goes the weasel" as follows: