PlayTone
STILL UNDER CONSTRUCTION
PlayTone(frequency, duration[, volume])
Description
PlayTone generates a tone with the specified frequency, duration and volume. Playback is immediate, with no on screen controls, making it excellent for user interactions and gaming. The tone is played asynchronously, so if you do PlayTone before the previous tone is complete, two tones will play at the same time, making chords possible.
frequency
duration
volume
PlayTone returns a reference to the sound. You can use this reference to control the sound.
Properties and Methods
soundRef.start(0) | Start playing the sound. PlaySound auto plays, so this is not normally needed. |
soundRef.stop(0) | Stop playing the sound. |
soundRef.loop | Make the sound loop endlessly |
Example (Basic)
PlaySound "BellToll.wav"
Make sound loop
bell = PlaySound("BellToll.wav") bell.loop=True
Stop playing sound
bell.stop()
Example (JavaScript)
NSB.PlaySound("BellToll.wav");
Make sound loop
bell = NSB.PlaySound("BellToll.wav"); bell.loop=true;
Stop playing sound
bell.stop()
Output
(sound of a bell tolling)