From Xojo Documentation
Used to play sounds.
Sound can play sound formats and simultaneous sounds as determined by the system.
On Windows, Sound can play a variety of sound formats but can only play WAV sounds simultaneously.
On macOS, AVFoundation is used to play sounds with support for a wide variety of sound formats.
This example plays a sound called "SledgeHammer" which has been added to the project:
This example loads a sound file called "Doh!" from the current directory (folder) into a sound object and plays it.
If f <> Nil Then
Dim s As Sound = f.OpenAsSound
If s <> Nil Then
// check f.LastErrorCode
// user cancelled
The following example plays the sound "Giggle", which has been added to the project, in an endless loop.
This example stops "Giggle".