PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

  • Stopping a non-locking sound
  • Size of sound files
  • Locking sound
  • Sound and component
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Sound (Function)
In French: Son
Plays a sound in WAV format. This sound can be:
  • stored on disk.
  • included in the library (.WDL).
  • found in a HFSQL memo.
Versions 16 and later
This function can also be used to:
  • WINDEVReports and QueriesWindowsWindows MobileUser code (UMC) play a system sound.
  • Versions 19 and later
    WINDEVWindows playing a sound of a given frequency during the requested time.
    New in version 19
    WINDEVWindows playing a sound of a given frequency during the requested time.
    WINDEVWindows playing a sound of a given frequency during the requested time.
New in version 16
This function can also be used to:
  • WINDEVReports and QueriesWindowsWindows MobileUser code (UMC) play a system sound.
  • Versions 19 and later
    WINDEVWindows playing a sound of a given frequency during the requested time.
    New in version 19
    WINDEVWindows playing a sound of a given frequency during the requested time.
    WINDEVWindows playing a sound of a given frequency during the requested time.
This function can also be used to:
  • WINDEVReports and QueriesWindowsWindows MobileUser code (UMC) play a system sound.
  • Versions 19 and later
    WINDEVWindows playing a sound of a given frequency during the requested time.
    New in version 19
    WINDEVWindows playing a sound of a given frequency during the requested time.
    WINDEVWindows playing a sound of a given frequency during the requested time.
Note: A sound card must be installed on the computer. The sound will be played according to the Windows settings (volume, balance, quality, etc.).
Versions 15 and later
Java This function is now available for the Java applications.
New in version 15
Java This function is now available for the Java applications.
Java This function is now available for the Java applications.
Versions 16 and later
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Android This function is now available for the Android applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Android Widget This function is now available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Example
WINDEVReports and QueriesUser code (UMC)
// Plays the sound found in the "TADA.WAV" file
Sound("Tada.wav")
// Plays while locking on sound card
Sound("tada.wav", soundWait)
// Plays while looping on sound card
Sound("C:\MSOFFICE\Sounds\Car.wav", soundLoop)
Windows Mobile
// Plays the sound found in the "TADA.WAV" file
Sound("Tada.wav")
// Plays while locking on sound card
Sound("tada.wav", soundWait)
// Plays while looping on sound card
Sound("\MSOFFICE\Sounds\Car.wav", soundLoop)
AndroidAndroid Widget
// Play the music.mp3 file included in the application
Sound("music.mp3")
Versions 19 and later
WINDEVWindows
// Plays a sound of a given frequency
LOOP (10)
FOR nSubscript = 1 to 5536 STEP 100
Sound(nSubscript, 1)
END
FOR nSubscript = 5536 to 1 STEP -100
Sound(nSubscript, 1)
END
END
New in version 19
WINDEVWindows
// Plays a sound of a given frequency
LOOP (10)
FOR nSubscript = 1 to 5536 STEP 100
Sound(nSubscript, 1)
END
FOR nSubscript = 5536 to 1 STEP -100
Sound(nSubscript, 1)
END
END
WINDEVWindows
// Plays a sound of a given frequency
LOOP (10)
FOR nSubscript = 1 to 5536 STEP 100
Sound(nSubscript, 1)
END
FOR nSubscript = 5536 to 1 STEP -100
Sound(nSubscript, 1)
END
END
Syntax

Playing a .WAV file Hide the details

Sound(<Name of WAV File> [, <Option>])
<Name of WAV File>: Character string (with quotes)
Full or relative name of file to play. This file can be:
  • WINDEV a WAV file.
  • Versions 16 and later
    Android an audio file corresponding to all the formats supported by the OS (wav, mp3, 3gp, ogg, ...). A summary of the supported audio files is available from the following address: http://developer.android.com/guide/appendix/media-formats.html. Note: the wav files in 32-bit format are not supported by Android.
    New in version 16
    Android an audio file corresponding to all the formats supported by the OS (wav, mp3, 3gp, ogg, ...). A summary of the supported audio files is available from the following address: http://developer.android.com/guide/appendix/media-formats.html. Note: the wav files in 32-bit format are not supported by Android.
    Android an audio file corresponding to all the formats supported by the OS (wav, mp3, 3gp, ogg, ...). A summary of the supported audio files is available from the following address: http://developer.android.com/guide/appendix/media-formats.html. Note: the wav files in 32-bit format are not supported by Android.
  • Versions 17 and later
    iPhone/iPad a file in wav format.
    New in version 17
    iPhone/iPad a file in wav format.
    iPhone/iPad a file in wav format.
  • Versions 21 and later
    Universal Windows 10 App a file in mp3, wav, wma or m4a format.
    New in version 21
    Universal Windows 10 App a file in mp3, wav, wma or m4a format.
    Universal Windows 10 App a file in mp3, wav, wma or m4a format.
Notes:
Versions 16 and later
  • AndroidAndroid Widget You cannot directly read an audio file found in a directory or in a sub-directory of the application. We advise you to read the audio files stored on the storage card (SysDirStorageCard to find out the path of storage card and SysStatusStorageCard to find out its name).
  • AndroidAndroid Widget The audio file to read can also be included in the application via the generation wizard. To read it, all you have to do is specify the file name (name + extension).
  • AndroidAndroid Widget iPhone/iPadUniversal Windows 10 App You cannot play a WAV file found in a HFSQL memo item.
New in version 16
  • AndroidAndroid Widget You cannot directly read an audio file found in a directory or in a sub-directory of the application. We advise you to read the audio files stored on the storage card (SysDirStorageCard to find out the path of storage card and SysStatusStorageCard to find out its name).
  • AndroidAndroid Widget The audio file to read can also be included in the application via the generation wizard. To read it, all you have to do is specify the file name (name + extension).
  • AndroidAndroid Widget iPhone/iPadUniversal Windows 10 App You cannot play a WAV file found in a HFSQL memo item.
  • AndroidAndroid Widget You cannot directly read an audio file found in a directory or in a sub-directory of the application. We advise you to read the audio files stored on the storage card (SysDirStorageCard to find out the path of storage card and SysStatusStorageCard to find out its name).
  • AndroidAndroid Widget The audio file to read can also be included in the application via the generation wizard. To read it, all you have to do is specify the file name (name + extension).
  • AndroidAndroid Widget iPhone/iPadUniversal Windows 10 App You cannot play a WAV file found in a HFSQL memo item.
<Option>: Optional integer constant
Runtime mode of sound:
soundWaitThe code is locked as long as the sound is not entirely played.
soundLoopThe sound is played in a loop.
Caution: The file to play must be found on disk and not in the library (WDL file).
soundDefault
(Default value)
The code continues to run as soon as the sound is started.
Versions 16 and later
WINDEVReports and QueriesWindows MobileUser code (UMC)

Playing a system sound Hide the details

Sound(<System Sound>)
<System Sound>: Constant
Preset system sound to play:
soundSystemCriticalStopSystem sound corresponding to the critical shutdown of the system.
soundSystemAsteriskAsterisk system sound.
soundSystemDefaultDefault system sound (beep in most cases).
soundSystemExclamationExclamation system sound.
soundSystemClosingSystem sound for closing Windows.
soundSystemQuestionQuestion system sound.
New in version 16
WINDEVReports and QueriesWindows MobileUser code (UMC)

Playing a system sound Hide the details

Sound(<System Sound>)
<System Sound>: Constant
Preset system sound to play:
soundSystemCriticalStopSystem sound corresponding to the critical shutdown of the system.
soundSystemAsteriskAsterisk system sound.
soundSystemDefaultDefault system sound (beep in most cases).
soundSystemExclamationExclamation system sound.
soundSystemClosingSystem sound for closing Windows.
soundSystemQuestionQuestion system sound.
WINDEVReports and QueriesWindows MobileUser code (UMC)

Playing a system sound Hide the details

Sound(<System Sound>)
<System Sound>: Constant
Preset system sound to play:
soundSystemCriticalStopSystem sound corresponding to the critical shutdown of the system.
soundSystemAsteriskAsterisk system sound.
soundSystemDefaultDefault system sound (beep in most cases).
soundSystemExclamationExclamation system sound.
soundSystemClosingSystem sound for closing Windows.
soundSystemQuestionQuestion system sound.
Versions 19 and later
WINDEVReports and QueriesUser code (UMC)

Playing a sound of a given frequency during the requested time Hide the details

<Result> = Sound(<Frequency> , <Duration>)
<Result>: Boolean
  • True if the sound was played,
  • False otherwise.
Note: Until Windows 7, the sound is played on the inside speaker of the PC. From Windows 7, the sound is played on the sound card.
<Frequency>: Unsigned integer
Frequency of the sound in Hertz.
Note: For the versions earlier than Windows 7, only the audible frequencies can be used (between 37 and 32767).
<Duration>: Unsigned integer
Duration (in milliseconds) during which the sound is played. Caution: the sound is locking. This parameter can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
New in version 19
WINDEVReports and QueriesUser code (UMC)

Playing a sound of a given frequency during the requested time Hide the details

<Result> = Sound(<Frequency> , <Duration>)
<Result>: Boolean
  • True if the sound was played,
  • False otherwise.
Note: Until Windows 7, the sound is played on the inside speaker of the PC. From Windows 7, the sound is played on the sound card.
<Frequency>: Unsigned integer
Frequency of the sound in Hertz.
Note: For the versions earlier than Windows 7, only the audible frequencies can be used (between 37 and 32767).
<Duration>: Unsigned integer
Duration (in milliseconds) during which the sound is played. Caution: the sound is locking. This parameter can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
WINDEVReports and QueriesUser code (UMC)

Playing a sound of a given frequency during the requested time Hide the details

<Result> = Sound(<Frequency> , <Duration>)
<Result>: Boolean
  • True if the sound was played,
  • False otherwise.
Note: Until Windows 7, the sound is played on the inside speaker of the PC. From Windows 7, the sound is played on the sound card.
<Frequency>: Unsigned integer
Frequency of the sound in Hertz.
Note: For the versions earlier than Windows 7, only the audible frequencies can be used (between 37 and 32767).
<Duration>: Unsigned integer
Duration (in milliseconds) during which the sound is played. Caution: the sound is locking. This parameter can correspond to:
  • an integer corresponding to the number of milliseconds,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s or 10 ms for example).
    New in version 23
    the direct indication of duration (1 s or 10 ms for example).
    the direct indication of duration (1 s or 10 ms for example).
Remarks

Stopping a non-locking sound

A sound played in non-locking mode can be stopped by the following code, called on a user action for example (click, control modification, etc.):
Sound("")

Size of sound files

Using large WAV files may trigger several problems (not enough RAM to load the sound, system stopped depending on the Windows version, etc.). For large ".WAV" files (several dozen megabytes), we recommend that you use the MCI functions.

Locking sound

A sound is necessarily locking:
  • If the sound is stored in a WINDEV library (.WDL file).
  • If the sound comes from a binary memo.

Sound and component

Sound is a non-locking function by default. To use Sound in a component without locking the application, you must comply with the following constraints:
  • The file corresponding to the sound must not be found in the WDL or in the component.
  • The file corresponding to the sound must be found in the EXE directory of the application.
Components
WINDEVReports and Queries wd230obj.dll
Windows Mobile wp230obj.dll
Java wd230java.jar
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment