Skip to content

Conversation

@rhurey
Copy link
Member

@rhurey rhurey commented Oct 28, 2025

Drop the placeholder KV resource.
Create a Foundry Resource in East US (One region VL is enabled)
Change VL Live tests from using saved wav files to instead using the Azure Speech SDK to synthesize text.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the Azure AI Voice Live test infrastructure by removing placeholder Key Vault resources and enabling Voice Live testing in East US with dynamic audio generation. The changes streamline the test setup by eliminating unused infrastructure and replacing static audio files with runtime-synthesized speech.

Key Changes:

  • Removed unused Key Vault resources from test infrastructure
  • Changed Voice Live tests to use Azure Speech SDK for dynamic audio generation instead of static WAV files
  • Added East US location support for test resources

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
sdk/ai/tests.yml Added East US location parameter for test deployment
sdk/ai/test-resources.json Removed Key Vault resources and outputs; renamed 'name' parameter to 'baseName'
sdk/ai/Azure.AI.VoiceLive/tests/VoiceLiveTestBase.cs Replaced audio file loading with Speech SDK-based audio generation; removed Setup method
sdk/ai/Azure.AI.VoiceLive/tests/LiveTests/BasicConversationTests.cs Updated test calls to use text-to-speech instead of WAV file names
sdk/ai/Azure.AI.VoiceLive/tests/ContentLoggingTests.cs Removed base.Setup() call and override keyword
sdk/ai/Azure.AI.VoiceLive/tests/ContentLoggingPerformanceTests.cs Removed unused imports and added Ignore attribute to flaky test
sdk/ai/Azure.AI.VoiceLive/tests/Azure.AI.VoiceLive.Tests.csproj Added Microsoft.CognitiveServices.Speech package dependency

using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Authentication.ExtendedProtection;
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This using statement for 'System.Security.Authentication.ExtendedProtection' appears to be unused. It should be removed if there are no references to types from this namespace in the file.

Suggested change
using System.Security.Authentication.ExtendedProtection;

Copilot uses AI. Check for mistakes.
Comment on lines +98 to +100
using (var synthsizer = new SpeechSynthesizer(sc, ac))
{
var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false);
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'synthsizer' to 'synthesizer'.

Suggested change
using (var synthsizer = new SpeechSynthesizer(sc, ac))
{
var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false);
using (var synthesizer = new SpeechSynthesizer(sc, ac))
{
var result = await synthesizer.SpeakTextAsync(text).ConfigureAwait(false);

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +107
var of = SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
var sc = SpeechConfig.FromEndpoint(new Uri(TestEnvironment.Endpoint), new AzureKeyCredential(TestEnvironment.ApiKey));
sc.SetSpeechSynthesisOutputFormat(of);
using (var ac = AudioConfig.FromWavFileOutput(path))
using (var synthsizer = new SpeechSynthesizer(sc, ac))
{
var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false);
if (result.Reason != ResultReason.SynthesizingAudioCompleted)
{
throw new Exception($"Error {result.Reason} was not synthesis completed");
}

return result.AudioData;
}
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The temporary file created on line 93 is never deleted, creating a resource leak. The file should be deleted after the audio synthesis is complete, preferably in a finally block or by wrapping the path creation in a try-finally pattern to ensure cleanup even if an exception occurs.

Suggested change
var of = SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
var sc = SpeechConfig.FromEndpoint(new Uri(TestEnvironment.Endpoint), new AzureKeyCredential(TestEnvironment.ApiKey));
sc.SetSpeechSynthesisOutputFormat(of);
using (var ac = AudioConfig.FromWavFileOutput(path))
using (var synthsizer = new SpeechSynthesizer(sc, ac))
{
var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false);
if (result.Reason != ResultReason.SynthesizingAudioCompleted)
{
throw new Exception($"Error {result.Reason} was not synthesis completed");
}
return result.AudioData;
}
try
{
var of = SpeechSynthesisOutputFormat.Riff24Khz16BitMonoPcm;
var sc = SpeechConfig.FromEndpoint(new Uri(TestEnvironment.Endpoint), new AzureKeyCredential(TestEnvironment.ApiKey));
sc.SetSpeechSynthesisOutputFormat(of);
using (var ac = AudioConfig.FromWavFileOutput(path))
using (var synthsizer = new SpeechSynthesizer(sc, ac))
{
var result = await synthsizer.SpeakTextAsync(text).ConfigureAwait(false);
if (result.Reason != ResultReason.SynthesizingAudioCompleted)
{
throw new Exception($"Error {result.Reason} was not synthesis completed");
}
return result.AudioData;
}
}
finally
{
try
{
if (File.Exists(path))
{
File.Delete(path);
}
}
catch
{
// Ignore exceptions during cleanup
}
}

Copilot uses AI. Check for mistakes.
throw new Exception($"Error {result.Reason} was not synthesis completed");
}

return result.AudioData;
Copy link

Copilot AI Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The AudioConfig writes to a file on line 97, but line 106 returns result.AudioData from the synthesizer result. This makes the file output configuration and temporary file path on lines 93-97 unnecessary. Either remove the file-based AudioConfig and use a memory-based configuration, or read from the generated file instead of using result.AudioData.

Copilot uses AI. Check for mistakes.
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="Microsoft.CognitiveServices.Speech" VersionOverride="1.46.0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you please be so kind as to explain an override is being used here and the plan for removing it for the longer-term?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants