Cluster Creator Kit Script Reference
    Preparing search index...

    Class AudioRecordItem

    Represents recorded audio data, or a part of it.

    Index

    Methods

    • Returns the playback duration of the audio in seconds.

      Returns number

    • Encodes the audio data into a string. This API is offered to Cluster Metaverse Lab and to partner companies and organizations authorized by Cluster, Inc. Results in an error if encoding is not permitted.

      Returns string

    • Restores audio data from a string-encoded representation of audio data, such as one created by serialize .

      serializedData is a string created by serializing the following proto3 ExportAudioRecord message into binary format (wire format) and then URL-safe base64 encoding it.

      syntax = "proto3";
      
      message ExportAudioRecord {
        oneof record {
          ExportOpusAudioRecord opus_audio_record = 1;
        }
      }
      message ExportOpusAudioRecord {
        repeated bytes opus_frame = 1; // Multiple Opus frames encoded with Opus 48kHz / single-channel / 40ms frame size
      }
      

      URL-safe base64 encoding refers to Base 64 Encoding with URL and Filename Safe Alphabet in RFC 4648 with the following modifications.

      • There is no trailing =
      • -_ is used instead of +/

      Opus frames stored in ExportOpusAudioRecord must satisfy the following constraints.

      • The frame size is fixed at 40ms (1920 samples at 48kHz). Other frame sizes cannot be used, because the playback duration must be computable from the number of frames.
      • FEC (Forward Error Correction) must be consistently enabled or disabled within a single piece of audio data. It must not be switched partway through.

      By storing multiple Opus frames generated by a single Opus encoder into separate AudioRecords, you can represent split audio data.

      When passing split audio data to an API such as AudioStream.add for playback, you must add them to the stream in the correct order.

      Parameters

      • serializedData: string

      Returns AudioRecord