Skip to content

Conversation

@CakeRepository
Copy link

@CakeRepository CakeRepository commented Mar 12, 2025

Purpose

Fixes bug where it wouldn't play audio in example .net error
Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
at SpeakerOutput.EnqueueForPlayback(BinaryData audioData) in D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic\SpeakerOutput.cs:line 29
at Program.Main(String[] args) in D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic\Program.cs:line 93
at Program.Main(String[] args) in D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic\Program.cs:line 42
at Program.

(String[] args)

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[X] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone https://github.com/CakeRepository/aoai-realtime-audio-sdk.git
cd aoai-realtime-audio-sdk
git checkout Audio-output-issues
npm install
  • Test the code
After pull and variables set for system to get Realtime Audio in Azure AI or OpenAI to function properly 
open the cloned directory in admin powershell and navigate cd .\dotnet\samples\console-from-mic\
dotnet run

What to Check

Verify that the following are valid

  • Conversation plays to default audio device
  • example console output:
    PS D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic> dotnet run
  • Connecting to Azure OpenAI endpoint (AZURE_OPENAI_ENDPOINT): https://cake-eus2.openai.azure.com/
  • Using API key (AZURE_OPENAI_API_KEY): 3wLa6**
  • Using deployment (AZURE_OPENAI_DEPLOYMENT): gpt-4o-mini-realtime-preview
    <<< Connected: session started

Listening to microphone input
(Just tell the app you're done to finish)

<<< Start of speech detected @ 00:00:01.4400000
<<< End of speech detected @ 00:00:02.6560000

USER: Hello, how are you?

I'm doing great, thank you! How about you?
<<< Start of speech detected @ 00:00:07.5840000
<<< End of speech detected @ 00:00:08.7680000

USER: Okay, have a good day

Thanks! You have a great day too! If you need anything else, just let me know. Goodbye!

Other Information

PS D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic> dotnet run
 * Connecting to Azure OpenAI endpoint (AZURE_OPENAI_ENDPOINT): https://URL.openai.azure.com/
 * Using API key (AZURE_OPENAI_API_KEY): **
 * Using deployment (AZURE_OPENAI_DEPLOYMENT): gpt-4o-mini-realtime-preview
 <<< Connected: session started
 >>> Listening to microphone input
 >>> (Just tell the app you're done to finish)

 <<< Start of speech detected @ 00:00:00.9920000
 <<< End of speech detected @ 00:00:01.6640000
 >>> USER: Hello

Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at SpeakerOutput.EnqueueForPlayback(BinaryData audioData) in D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic\SpeakerOutput.cs:line 29
   at Program.Main(String[] args) in D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic\Program.cs:line 93
   at Program.Main(String[] args) in D:\repo\aoai-realtime-audio-sdk\dotnet\samples\console-from-mic\Program.cs:line 42
   at Program.<Main>(String[] args)
@CakeRepository CakeRepository changed the title 🔨 fixes output bug I was having see output 🔨 fixes output bug with NULL responses instead of crashing .net Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant