Action denied

Audio Sources

This table contains various functions that allow to control audio sources. On top of the basic functions for playing and stopping sounds, you can also modify the sound's pitch and volume or even apply a low pass filter from script.

AudioSource.play(objectId, restart)

Plays the audio source attached to object with objectId (transform id). If the source is already playing,

  • if restart is not specified or false, it will not be restarted.
  • if restart is equal to true, it will be restarted.
function AudioSource.play(objectId, restart) 

AudioSource.playDelayed(objectId, restart)

Plays the audio source attached to the object with objectId (transform id) with a delay of delay (float) seconds after the call of the function. If the sound is already being played, it will not be restarted.

function AudioSource.playDelayed(objectId, restart) 

AudioSource.setTimeAndPlay(objectId, time)

Sets the playback time of the audio source attached to the object with objectId (transform id) to time seconds. Use this if you want to jump to a different playback time, i.e. to skip the first 5 seconds of an audio file.

function AudioSource.setTimeAndPlay(objectId, time) 

AudioSource.getIsPlaying(objectId)

Returns true if the audio source attached to the object with objectId is currently being played and false otherwise.

function AudioSource.getIsPlaying(objectId) 

AudioSource.stop(objectId)

Stops playing the audio source attached to the object with objectId (transform id).

function AudioSource.stop(objectId) 

AudioSource.setPitch(objectId, pitch)

Sets the pitch of the audio source attached to the object with objectId (transform id) to pitch (float, recommended between 0.5 and 2).

function AudioSource.setPitch(objectId, pitch) 

AudioSource.setVolume(objectId, volume)

Sets the volume of the audio source attached to the object with objectId (transform id) to volume (float, recommended between 0.001 and 2).

function AudioSource.setVolume(objectId, volume) 

AudioSource.getLength(int, float)

Returns the length of the audio source attached to the object with objectId (transform id) in seconds. This will return a float value.

function AudioSource.getLength(int, float) 

AudioSource.setLowPass(objectId, amount, cutoff)

Applies a low pass to the audio source attached to the object with objectId (transform id).

  • amount: strength of the lowpass (range between 0 and 1)
  • cutoff: cutoff frequency in Hertz (default: 2500 Hz if no value is specified).
function AudioSource.setLowPass(objectId, amount, cutoff) 

All contents of this page may be used for modding use for Winter Resort Simulator only. Any use exceeding this regulation is not permitted.

Copyright (C) HR Innoways, 2020. All Rights Reserved.