PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN

  • 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/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Sound (Function)
In french: Son
Plays a sound in WAV format. This sound can be:
  • stored on the disk.
  • included in the library (.WDL).
  • in an HFSQL memo.
Versions 16 and later
This function can also be used to:
    New in version 16
    This function can also be used to:
      This function can also be used to:
        Remark: A sound card must be installed on the computer. The sound will be played according to the Windows settings (volume, balance, quality, etc.).
        Versions 16 and later
        Android This function is now available for Android applications.
        Universal Windows 10 App This function is now available for Windows Phone applications.
        New in version 16
        Android This function is now available for Android applications.
        Universal Windows 10 App This function is now available for Windows Phone applications.
        Android This function is now available for Android applications.
        Universal Windows 10 App This function is now available for Windows Phone applications.
        Versions 17 and later
        iPhone/iPad This function is now available for iPhone/iPad applications.
        New in version 17
        iPhone/iPad This function is now available for iPhone/iPad applications.
        iPhone/iPad This function is now available for 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
        AndroidAndroid Widget
        // Play the music.mp3 file included in the application
        Sound("music.mp3")
        Syntax

        Playing a .WAV file Hide the details

        Sound(<Name of WAV file> [, <Option>])
        <Name of WAV file>: Character string
        Full or relative name of file to play. This file can be:
        • Versions 16 and later
          Android an audio file corresponding to all the formats supported by the OS (wav, mp3, 3gp, ogg, etc.). A summary of the supported audio files is available from the following address: http://developer.android.com/guide/appendix/media-formats.html.
          Remarks:
          • Android does not support 32-bit wav files.
          • This parameter can correspond to a URL. In this case, it is necessary to add the INTERNET permission when generating the application.
          New in version 16
          Android an audio file corresponding to all the formats supported by the OS (wav, mp3, 3gp, ogg, etc.). A summary of the supported audio files is available from the following address: http://developer.android.com/guide/appendix/media-formats.html.
          Remarks:
          • Android does not support 32-bit wav files.
          • This parameter can correspond to a URL. In this case, it is necessary to add the INTERNET permission when generating the application.
          Android an audio file corresponding to all the formats supported by the OS (wav, mp3, 3gp, ogg, etc.). A summary of the supported audio files is available from the following address: http://developer.android.com/guide/appendix/media-formats.html.
          Remarks:
          • Android does not support 32-bit wav files.
          • This parameter can correspond to a URL. In this case, it is necessary to add the INTERNET permission when generating the application.
        • 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.
        Remarks:
        Versions 16 and later
        • AndroidAndroid Widget You cannot directly play an audio file in a directory or in a subdirectory of the application. It is recommended to play the audio files on the storage card (use SysDirStorageCard to get the storage card path and SysStatusStorageCard to get its name).
        • AndroidAndroid Widget The audio file to play can also be included in the application via the generation wizard. To play it, simply specify the file name (name + extension).
        • Universal Windows 10 AppAndroidAndroid Widget iPhone/iPad WAV files in HFSQL memo items cannot be played.
        New in version 16
        • AndroidAndroid Widget You cannot directly play an audio file in a directory or in a subdirectory of the application. It is recommended to play the audio files on the storage card (use SysDirStorageCard to get the storage card path and SysStatusStorageCard to get its name).
        • AndroidAndroid Widget The audio file to play can also be included in the application via the generation wizard. To play it, simply specify the file name (name + extension).
        • Universal Windows 10 AppAndroidAndroid Widget iPhone/iPad WAV files in HFSQL memo items cannot be played.
        • AndroidAndroid Widget You cannot directly play an audio file in a directory or in a subdirectory of the application. It is recommended to play the audio files on the storage card (use SysDirStorageCard to get the storage card path and SysStatusStorageCard to get its name).
        • AndroidAndroid Widget The audio file to play can also be included in the application via the generation wizard. To play it, simply specify the file name (name + extension).
        • Universal Windows 10 AppAndroidAndroid Widget iPhone/iPad WAV files in HFSQL memo items cannot be played.
        <Option>: Optional integer constant
        Sound execution mode:
        soundDefault
        (Default value)
        The code continues to run as soon as the sound is started.
        soundLoopThe sound is played in a loop.
        Caution: The file to play must be found on disk and not in the library (WDL file).
        soundWaitThe code is locked as long as the sound is not entirely played.
        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-blocking 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.
        Business / UI classification: UI Code
        Component: wd270obj.dll
        Minimum version required
        • Version 9
        This page is also available for…
        Comments
        Click [Add] to post a comment