Skip to content

llSetSoundRadius

function
Function syntax
llSetSoundRadius(
  1. 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.

How to use
llSetSoundRadius(0.0);
  • This function is a prim property, thus will survive script resets.
  • Has no effect on llTriggerSound or llLinkPlaySound in triggered mode. Sounds will play regardless of listener position.
  • llTriggerSoundLimited can 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 llPlaySound or llLinkPlaySound in 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 llLoopSound or llLinkPlaySound in looped mode, the sound will be played from the beginning every time the observer’s ear position enters the radius.
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

Added in SL 0.4.0

The original wiki page documents these functions together with this one:

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.

  1. Viewer 746d768339: newview/llaudiosourcevo.cpp:60-80; newview/llaudiosourcevo.cpp:130-147; newview/llviewerobject.cpp:1366-1369 ↩

  2. Viewer 746d768339: newview/llaudiosourcevo.cpp:103-128; newview/app_settings/settings.xml:13783-13793 ↩

  3. Viewer 746d768339: newview/llaudiosourcevo.cpp:82-101 ↩

  4. Viewer 746d768339: newview/llaudiosourcevo.cpp:68-73; newview/llaudiosourcevo.cpp:141-147 ↩

  5. Viewer 746d768339: newview/llaudiosourcevo.cpp:68-73; newview/llaudiosourcevo.cpp:141-147 ↩