-
-
Save hatsunea/697c3b60c16058bad81ca630bd0862d9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ws = new ClientWebSocket(); | |
| ws.Options.SetRequestHeader("api-key", "<YOUR_KEY>"); | |
| await ws.ConnectAsync( | |
| new Uri("wss://eastus.api.cognitive.microsoft.com/voice/live/ws?model=gpt-realtime-mini"), | |
| CancellationToken.None); | |
| // session.update | |
| var json = @" | |
| { | |
| ""type"": ""session.update"", | |
| ""session"": { | |
| ""input_audio_format"": ""pcm16"", | |
| ""output_audio_format"": ""pcm16"", | |
| ""turn_detection"": { ""type"": ""server_vad"" } | |
| } | |
| }"; | |
| await ws.SendAsync( | |
| new ArraySegment<byte>(Encoding.UTF8.GetBytes(json)), | |
| WebSocketMessageType.Text, true, CancellationToken.None); | |
| // ここから PCM16 を ws.SendAsync(..., WebSocketMessageType.Binary) で送る |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment