A sound holds audio, loaded from a WAV file or recorded using an
audio_recorder. sound->play
plays it on the default audio output. A sound may be played several
times at once, e.g., for the sound effects of
a game. When a play is finished, sound<-message
is executed:
new(S, sound('click.wav')),
send(S, message, message(@prolog, clicked, @arg1)),
send(S, play).
If xpce is built with SDL3_sound, a sound can be loaded from WAV,
MP3, Ogg Vorbis, FLAC, AIFF, AU, VOC and module (MOD, XM, IT, ...)
files, and @pce
has the feature sound_decoders (see
pce->has_feature). Otherwise only WAV
files are supported.
display<-sound_file_extensions
lists the extensions of the files that can be loaded. A sound is decoded
completely when loaded and saved as WAV.
->stop.
.g., to make a beep. The tone fades
in and out over 5 milliseconds to avoid clicks. display->bell
plays such a tone..0..1.0] Play the
sound on the default audio output. The default volume is 1.0.
This returns immediately.parts
equal parts of the sound: the largest absolute sample value of all
channels. This is typically used to draw the waveform.