Image bm909.GIF Play Sound
Sound
 
Image bm909.GIF play sound
Image bm918.GIF sound to be played
Image bm919.GIF sound volume (0 to 1)
Image bm920.GIF stereophonic balance  (-1=left to +1=right; 0=middle)
Image bm921.GIF speed of playing (1 = usual)
Image bm922.GIF repetition number (0 = permanently)
Image bm923.GIF break playing sound
 
The service of the sound playback depends on the sound format. The most common sound format is the non-compressed PCM format, sample rate of 11025, 22050, or 44100 Hz, stereo or mono, 8 or 16 bits. This format is also used for sound recording in the editor environment. As the only format it enables a multi-channel playback of sound as well as the volume and stereophonic balance service. A sound playback run in another format causes switching off the other sounds; the parameters for volume and stereophonic balance setting exert no influence on the sound playback.
 
The sound volume parameter is a numeric parameter serving to adjust the played sound volume. The sound volume can be adjusted in the non-compressed PCM sound format only. The value range is 0 (=silence) till 1 (=normal volume). The default value is 1.
 
The stereophonic balance parameter is a numeric parameter serving to adjust the sound position in the stereophonic base. The stereophonic balance of a sound cannot be adjusted unless the non-compressed PCM sound format is used. The value range is -1 (left) to +1 (=right), 0 being the center. The default value is 0 (=center).
 
The speed of playing parameter is a numeric parameter determining at which speed the sound will be played back. It governs the relative sound pitch. Without entering it its value is set to 1, indicating, that the speed is not changed. Increasing the number increases the playback speed and vice versa. For example, by entering 2 the sound will be played at double the speed, by entering 0.5 at half the speed.
 
The repetition number parameter is a numeric parameter defining the number of sound playbacks. Setting it to 0 causes a permanent sound playback. The default value is 1.
 
The break playing sound parameter is a logic flag ensuring a playback interruption of the previous identical sound. The flag default setting is "on". Each sound can be played only once at a time. If the interruption flag is not switched on and the sound is already being played, the new sound parameters only will be set. In this manner the volume, stereophonic balance and repetition number of a sound being already played back may be changed. If the interruption flag is on, the previous playback of this sound is interrupted, and the sound will be played from the beginning with the new parameters. If one sound needs to be played several times at a time, additional distinguish code can be used.
 
From among sound formats other than PCM especially the Microsoft ADPCM, compressing the sound with a 1:4 ratio, can be recommended. The sound playback quality is relatively high, the format being supported by all Windows versions. Another supported and recommended format is the MPEG Layer-3 (MP3), which reaches a high compression ratio (1:10 about), at the same time maintaining its high sound quality. A disadvantage is the necessity of installing a driver for the playback in some Windows versions, see e.g. http://www.iis.fhg.de/audio, (c) FraunHofer IIS. If need be, you can install the driver directly from the distribution CD-ROM of the Peter application's folder MP3CODEC.
 
Whether the sound playback is supported or not can be found out immediately after starting the playback by testing, whether the sound is being played back. There are following reasons for the sound not being played back: the computer does not contain a sound card or its driver, the sound channel is occupied by another program, or no driver is installed to play back the sound format. The last reason concerns especially playing back the MP3 format, which is not supported in some Windows versions, if appropriate driver is not installed. In some cases it can be an option "sound codecs" of installed Windows components, which must be switched on.
 
To provide for the continuity of playing back sounds in the PCM format a buffer is made use of. In case of an already running sound playback this may cause a delay in response to starting to play back another sound, or a delay in response to a sound parameter change of up to 0.3 seconds. If a DirectX support is installed on the computer, then DirectSound support is used to play sounds and this delay can be considerably shorter, 0.05 seconds typically.

Full Html Context Help of The Peter - Gemtree Software & Children Programming