Lingo Dictionary > S > sampleRate |  |

sampleRate

Syntax

    member(whichCastMember).sampleRate
    the sampleRate of member whichCastMember
    sound(channelNum).sampleRate

Description

Cast member property; returns, in samples per second, the sample rate of the sound cast member or in the case of SWA sound, the original file that has been Shockwave Audio-encoded. This property is available only after the SWA sound begins playing or after the file has been preloaded using the `preLoadBuffer()` command. When a sound channel is given, the result is the sample rate of the currently playing sound cast member in the given sound channel.

This property can be tested but not set. Typical values are 8000, 11025, 16000, 22050, and 44100.

When multiple sounds are queued in a sound channel, Director plays them all with the `channelCount`, `sampleRate`, and `sampleSize` of the first sound queued, resampling the rest for smooth playback. Director resets these properties only after the channel's sound queue is exhausted or a stop() command is issued. The next sound to be queued or played then determines the new settings.

Example

This statement assigns the original sample rate of the file used in SWA streaming cast member Paul Robeson to the field cast member Sound Quality:

    member("Sound Quality").text = string(member("Paul Robeson").sampleRate)"

Example

This statement displays the sample rate of the sound playing in sound channel 1 in the Message window:

    put sound(1).sampleRate