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
LyriaSessionService
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
|
Edit this page
View Source
WebSocket
Declaration
public IWebSocket WebSocket { get; }
Property Value
Methods
|
Edit this page
View Source
ConnectAsync(string)
Declaration
public UniTask ConnectAsync(string modelId = null)
Parameters
| Type |
Name |
Description |
| string |
modelId |
|
Returns
|
Edit this page
View Source
DisconnectAsync()
Declaration
public UniTask DisconnectAsync()
Returns
|
Edit this page
View Source
Dispose()
Declaration
|
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
|
Edit this page
View Source
PauseAsync()
Declaration
public UniTask PauseAsync()
Returns
|
Edit this page
View Source
PlayAsync()
Declaration
public UniTask PlayAsync()
Returns
|
Edit this page
View Source
ResetAsync()
Declaration
public UniTask ResetAsync()
Returns
|
Edit this page
View Source
SendPromptAsync(string, float)
Declaration
public UniTask SendPromptAsync(string promptText, float weight = 1)
Parameters
Returns
|
Edit this page
View Source
SendPromptsAsync(params Prompt[])
Declaration
public UniTask SendPromptsAsync(params Prompt[] prompts)
Parameters
| Type |
Name |
Description |
| Prompt[] |
prompts |
|
Returns
|
Edit this page
View Source
SetClientContentAsync(BidiGenerateMusicClientContent)
Declaration
public UniTask SetClientContentAsync(BidiGenerateMusicClientContent clientContent)
Parameters
Returns
|
Edit this page
View Source
SetModelAsync(string)
Declaration
public UniTask SetModelAsync(string model)
Parameters
| Type |
Name |
Description |
| string |
model |
|
Returns
|
Edit this page
View Source
SetMusicGenerationConfigAsync(BidiGenerateMusicGenerationConfig)
Declaration
public UniTask SetMusicGenerationConfigAsync(BidiGenerateMusicGenerationConfig config)
Parameters
Returns
|
Edit this page
View Source
SetSetupAsync(BidiGenerateMusicSetup)
Declaration
public UniTask SetSetupAsync(BidiGenerateMusicSetup setup)
Parameters
Returns
|
Edit this page
View Source
StopAsync()
Declaration
public UniTask StopAsync()
Returns
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
|
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
|
Edit this page
View Source
onReceiveAudioData
Invoked when streaming audio data is received.
Declaration
public event Action<IAudioBuffer> onReceiveAudioData
Event Type
|
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
|
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
|
Edit this page
View Source
onSetupComplete
Invoked when the Lyria Session setup is complete.
Declaration
public event Action onSetupComplete
Event Type
Implements
Extension Methods