llSetSoundRadius
llSetSoundRadius(float radius// Maximum distance in meters at which the sounds can be heard
);- Energy
- 10
Establishes a hard cut-off radius for audibility for llPlaySound, llLoopSound and llLinkPlaySound in non-triggered mode. Sounds are not heard until an observer’s ear position enters the radius, and immediately stop when leaving the radius.1 The viewer measures the distance from the camera by default, or from the avatar if the MediaSoundsEarLocation setting is changed;2 for attached objects the distance is measured from the wearer’s position, not the prim.3 A radius below 0.1 m is treated as off.4 Volume fading is still determined by the distance from the ear position, not the radius.
llSetSoundRadius(0.0);Caveats
Section titled “Caveats”- This function is a prim property, thus will survive script resets.
- Has no effect on
llTriggerSoundorllLinkPlaySoundin triggered mode. Sounds will play regardless of listener position. llTriggerSoundLimitedcan be used instead for a similar effect but the function always depends on avatar position, regardless of the viewer’s ear setting.- When used with
llPlaySoundorllLinkPlaySoundin non-looped mode, the sound will be played from the beginning only once, when the observer’s ear position enters the radius for the first time. This can happen significantly later than a one-off sound was actually played. - With
llLoopSoundorllLinkPlaySoundin looped mode, the sound will be played from the beginning every time the observer’s ear position enters the radius.
Examples
Section titled “Examples”Enable sound cutoff at 4 meters.
llSetSoundRadius(4); //Enable sound cutoff at 4 meters.Disable sound cutoff.
llSetSoundRadius(0); //Disable sound cutoff.Pass 0 to this function to disable it; the viewer treats any radius below 0.1 m as off.5
History
Section titled “History”Added in SL 0.4.0
Related functions
Section titled “Related functions”The original wiki page documents these functions together with this one:
Known issues
Section titled “Known issues”- SVC-3058: Function:
llSetSoundRadius( float radius ); fails to limit sound to radius
See also
Section titled “See also”Functions
Section titled “Functions”Original wiki source
Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.
Footnotes
Section titled “Footnotes”-
Viewer
746d768339:newview/llaudiosourcevo.cpp:60-80;newview/llaudiosourcevo.cpp:130-147;newview/llviewerobject.cpp:1366-1369↩ -
Viewer
746d768339:newview/llaudiosourcevo.cpp:103-128;newview/app_settings/settings.xml:13783-13793↩ -
Viewer
746d768339:newview/llaudiosourcevo.cpp:82-101↩ -
Viewer
746d768339:newview/llaudiosourcevo.cpp:68-73;newview/llaudiosourcevo.cpp:141-147↩ -
Viewer
746d768339:newview/llaudiosourcevo.cpp:68-73;newview/llaudiosourcevo.cpp:141-147↩