SOUND
 
Plays a generated tone through sfxlib.

Syntax


Sound frequency, duration
Sound channel, frequency, duration, volume


Description

SOUND is the easiest way to make the computer produce a pitched tone. The frequency tells sfxlib how high the tone is. A value of 440 produces the concert A above middle C; lower numbers sound lower and higher numbers sound higher.

The duration tells sfxlib how long to play the tone. Fractional values are useful for short game sounds and musical notes, for example 0.25 for roughly a quarter of a second. The classic two-argument BASIC form is kept for simple programs and compatibility-minded code.

The four-argument form is for programs that need more control. The first argument selects the sfxlib channel, so different sounds can be organized separately. The last argument sets the loudness for that tone.


Example

sound 440, 0.25
sound 1, 660, 0.20, 0.5
sleep 300, 1


Notes

  • Use NOTE when you want to name musical notes instead of calculating frequencies.
  • Use TONE when you always want to be explicit about the channel.


See also