• Studio

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • AudioClip

    Inherits from: Object

    AudioClip serves as a container for audio data, including music, voiceovers, and sound effects. It offers properties and methods to access playback details like length, samples, channels, and frequency. AudioClip supports preloading, 3D audio, and background loading. Custom AudioClip instances can be created programmatically. Fundamental for auditory experiences in Unity projects, AudioClip documentation provides further details.

    Properties

    length

    number

    Returns the clip's duration in seconds, akin to a song's length.

    samples

    number

    Refers to the total number of audio samples within the clip.

    channels

    number

    Represents the number of audio channels, such as 1 for mono or 2 for stereo.

    frequency

    number

    Denotes the sample rate of the clip in kHz, indicating the samples per second.

    Controls whether the audio data should be preloaded upon clip asset loading.

    ambisonic

    boolean

    Indicates if the clip is ambisonic, providing 3D audio capabilities.

    Specifies if the clip should load in the background, allowing gameplay to continue.

    Methods

    Initiates loading of the clip's audio data, particularly when 'preloadAudioData' is false.

    Returns

    boolean

    True if data loading starts successfully.

    Unloads the clip's audio data from memory, aiding in efficient memory usage.

    Returns

    boolean

    True if data unloading begins successfully.

    Generates a new AudioClip with specified parameters, optionally streaming from disk.

    Parameters

    name

    string

    The name for the new AudioClip.

    lengthSamples

    number

    The total length of the clip in samples.

    channels

    number

    The number of audio channels.

    frequency

    number

    The sample rate of the clip.

    stream

    boolean

    Whether the audio data is streamed from disk.

    Returns

    AudioClip

    A new AudioClip instance.

    Updated 4 months ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.