Search Results for

    Show / Hide Table of Contents

    Class LyriaSessionService

    Service class that manages the WebSocket connection to the Lyria music generation API, handles sending control messages, and processes incoming audio data and events.

    Inheritance
    object
    LyriaSessionService
    Implements
    IWebSocketListener<BidiGenerateMusicServerMessage>
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit.Google.Lyria
    Assembly: Glitch9.AIDevKit.Provider.Google.dll
    Syntax
    public class LyriaSessionService : IWebSocketListener<BidiGenerateMusicServerMessage>, IDisposable

    Constructors

    | Edit this page View Source

    LyriaSessionService(string)

    Declaration
    public LyriaSessionService(string modelId = "models/lyria-realtime-exp")
    Parameters
    Type Name Description
    string modelId

    Properties

    | Edit this page View Source

    IsConnected

    Declaration
    public bool IsConnected { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    WebSocket

    Declaration
    public IWebSocket WebSocket { get; }
    Property Value
    Type Description
    IWebSocket

    Methods

    | Edit this page View Source

    ConnectAsync(string)

    Declaration
    public UniTask ConnectAsync(string modelId = null)
    Parameters
    Type Name Description
    string modelId
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    DisconnectAsync()

    Declaration
    public UniTask DisconnectAsync()
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    Dispose()

    Declaration
    public void Dispose()
    | Edit this page View Source

    OnWebSocketBinaryReceived(byte[])

    Declaration
    public void OnWebSocketBinaryReceived(byte[] binaryData)
    Parameters
    Type Name Description
    byte[] binaryData
    | Edit this page View Source

    OnWebSocketMessageReceived(BidiGenerateMusicServerMessage)

    Declaration
    public void OnWebSocketMessageReceived(BidiGenerateMusicServerMessage message)
    Parameters
    Type Name Description
    BidiGenerateMusicServerMessage message
    | Edit this page View Source

    PauseAsync()

    Declaration
    public UniTask PauseAsync()
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    PlayAsync()

    Declaration
    public UniTask PlayAsync()
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    ResetAsync()

    Declaration
    public UniTask ResetAsync()
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    SendPromptAsync(string, float)

    Declaration
    public UniTask SendPromptAsync(string promptText, float weight = 1)
    Parameters
    Type Name Description
    string promptText
    float weight
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    SendPromptsAsync(params Prompt[])

    Declaration
    public UniTask SendPromptsAsync(params Prompt[] prompts)
    Parameters
    Type Name Description
    Prompt[] prompts
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    SetClientContentAsync(BidiGenerateMusicClientContent)

    Declaration
    public UniTask SetClientContentAsync(BidiGenerateMusicClientContent clientContent)
    Parameters
    Type Name Description
    BidiGenerateMusicClientContent clientContent
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    SetModelAsync(string)

    Declaration
    public UniTask SetModelAsync(string model)
    Parameters
    Type Name Description
    string model
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    SetMusicGenerationConfigAsync(BidiGenerateMusicGenerationConfig)

    Declaration
    public UniTask SetMusicGenerationConfigAsync(BidiGenerateMusicGenerationConfig config)
    Parameters
    Type Name Description
    BidiGenerateMusicGenerationConfig config
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    SetSetupAsync(BidiGenerateMusicSetup)

    Declaration
    public UniTask SetSetupAsync(BidiGenerateMusicSetup setup)
    Parameters
    Type Name Description
    BidiGenerateMusicSetup setup
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    StopAsync()

    Declaration
    public UniTask StopAsync()
    Returns
    Type Description
    UniTask

    Events

    | Edit this page View Source

    onError

    Invoked when an error occurs during communication with the Lyria service.

    Declaration
    public event Action<Exception> onError
    Event Type
    Type Description
    Action<Exception>
    | Edit this page View Source

    onPlaybackControlSent

    Invoked when a playback control command is sent and successfully processed.

    Declaration
    public event Action<BidiGenerateMusicPlaybackControl> onPlaybackControlSent
    Event Type
    Type Description
    Action<BidiGenerateMusicPlaybackControl>
    | Edit this page View Source

    onReceiveAudioData

    Invoked when streaming audio data is received.

    Declaration
    public event Action<IAudioBuffer> onReceiveAudioData
    Event Type
    Type Description
    Action<IAudioBuffer>
    | Edit this page View Source

    onReceiveFilteredPrompt

    Invoked when a filtered prompt is received from the Lyria service.

    Declaration
    public event Action<string> onReceiveFilteredPrompt
    Event Type
    Type Description
    Action<string>
    | Edit this page View Source

    onReceiveWarning

    Invoked when a warning message is received from the Lyria service.

    Declaration
    public event Action<string> onReceiveWarning
    Event Type
    Type Description
    Action<string>
    | Edit this page View Source

    onSetupComplete

    Invoked when the Lyria Session setup is complete.

    Declaration
    public event Action onSetupComplete
    Event Type
    Type Description
    Action

    Implements

    IWebSocketListener<T>
    IDisposable

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.TryDispose(IDisposable)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation