PowerBASIC has only one function to create a sound, the function BEEP. There are no built-in function to play standard sound files (*.wav) nor midi files (*.mid).

There are several Windows API which can be used to play sounds, including the sndPlaySound and WinBeep API.

Both of these are included in the that is distributed with PowerBASIC, so the declaration statements do not need to be put in the application as long as the #INCLUDE "" compiler directive is included.

Here is an example of using the WinBeep API.

            (BYVAL dwFreq AS DWORD, BYVAL dwDuration AS DWORD) AS LONG
    WinBeep 1000, 2000   'play 1000Hz sound for two seconds

And here are several sndPlaySound API example.

    Declare Function sndPlaySound Lib "winmm.dll" 
         Alias "sndPlaySoundA" (ByVal lpszSoundName As String,
         ByVal uFlags as Long) as Long
    Dim iReturn As Long, SoundFile As String
    SoundFile = "sound.wav"  'set filename of sound to play
    iReturn = sndPlaySound(SoundFile, &H1)  'once, in background
    iReturn = sndPlaySound(SoundFile, &H0)  'once, wait until done
    iReturn = sndPlaySound(SoundFile, &H8)  'play continuously
    iReturn = sndPlaySound(vbNullString, False) 'stop playing sound

Not shown here, the mciSendString API can be used to play midi files.

Unlike Visual Basic, PowerBASIC does not come with a built in control to play sounds. If the use of API, as discussed above, doesn't satisfy your need, you have two other choices.

Sound Function Reference
Here's a quick reference of the available sound functions, in alphabetical order.

Note that the default Windows sound can be changed using the control panel, or by using an API call.

If you have any suggestions or corrections, please let me know.