• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • AudioShader

    Inherits from: Object

    Provides functionality for audio manipulation and playback, including volume and pitch adjustments, spatial considerations, and muting capabilities.

    Properties

    isMuted

    boolean

    Indicates whether the audio is currently muted.

    -- Check if the audio is muted
    local isMuted = audioShaderInstance.isMuted
    
    print(tostring(isMuted) -- true or false
    

    Defines the range in which the audio can be heard.

    -- Set the spatial range of the audio
    audioShaderInstance.spatialRange = 10
    

    volume

    number

    Controls the playback volume of the audio.

    -- Set the volume of the audio
    audioShaderInstance.volume = 0.5
    

    Sets a range for random volume variation.

    -- Set the random volume range of the audio
    audioShaderInstance.randomVolume = 0.1
    

    pitch

    number

    Adjusts the pitch of the audio playback.

    -- Set the pitch of the audio
    audioShaderInstance.pitch = 1.2
    

    Sets a range for random pitch variation.

    -- Set the random pitch range of the audio
    audioShaderInstance.randomPitch = 0.2
    

    Methods

    Begins playback of the audio with optional volume and pitch parameters.

    -- Play the audio with custom volume and pitch
    audioShaderInstance:Play(0.8, 1.1)
    

    Parameters

    volume

    number

    The volume at which to play the audio. Overrides the instance's volume property for this playback.

    pitch

    number

    The pitch at which to play the audio. Overrides the instance's pitch property for this playback.

    Returns

    void

    This method does not return a value.

    Returns a randomly selected AudioClip from the available set.

    -- Get a random AudioClip
    local randomClip = audioShaderInstance:GetRandomClip()
    

    Returns

    AudioClip

    The randomly selected AudioClip object.

    Creates a new instance of AudioShader with a specified AudioClip.

    -- Create a new AudioShader instance with the specified AudioClip
    local audioShaderInstance = AudioShader.Create(clip)
    

    Parameters

    The AudioClip to associate with the new AudioShader instance.

    Returns

    AudioShader

    A new instance of AudioShader configured with the provided AudioClip.

    Updated about 1 month ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.