Table of Contents

Class LiveMusicAudioChunkReceivedEventArgs

Namespace
GenerativeAI.Live
Assembly
GenerativeAI.Live.dll

Provides data for the AudioChunkReceived event.

public class LiveMusicAudioChunkReceivedEventArgs : EventArgs
Inheritance
LiveMusicAudioChunkReceivedEventArgs
Inherited Members
Extension Methods

Constructors

LiveMusicAudioChunkReceivedEventArgs(AudioChunk, int, int)

Initializes a new instance of the LiveMusicAudioChunkReceivedEventArgs class.

public LiveMusicAudioChunkReceivedEventArgs(AudioChunk chunk, int sampleRate, int channels)

Parameters

chunk AudioChunk

The audio chunk received from the server.

sampleRate int

The sample rate of the audio, in Hz.

channels int

The number of audio channels.

Properties

Channels

Gets the number of audio channels. Parsed from the channels= parameter of the MIME type, or 2 (Lyria RealTime outputs stereo) when not specified.

public int Channels { get; }

Property Value

int

Chunk

Gets the audio chunk as received from the server.

public AudioChunk Chunk { get; }

Property Value

AudioChunk

Data

Gets the decoded raw audio bytes (16-bit PCM unless MimeType says otherwise).

public byte[] Data { get; }

Property Value

byte[]

MimeType

Gets the MIME type of the audio chunk (for example audio/l16;rate=48000;channels=2), if provided.

public string? MimeType { get; }

Property Value

string

SampleRate

Gets the sample rate of the audio, in Hz. Parsed from the rate= parameter of the MIME type, or 48000 (Lyria RealTime's output rate) when not specified.

public int SampleRate { get; }

Property Value

int

SourceMetadata

Gets the prompts and config used to generate this chunk, if provided by the server.

public LiveMusicSourceMetadata? SourceMetadata { get; }

Property Value

LiveMusicSourceMetadata