Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,676 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have microsoft azure kinect dk device. This device have 7 microphones array.
I using azure SpeechRecognizer and get audio from specific angle. But all angle will recognize.
Start angle 70, End angle 110.
static void Main(string[] args)
{
SpeechConfig speechConfig;
AudioProcessingOptions audioProcessingOptions;
AudioConfig audioInput;
SpeechRecognizer recognizer = null;
bool initial = false;
// https://video2.skills-academy.com/zh-cn/azure/ai-services/speech-service/how-to-select-audio-input-devices
var enumerator = new MMDeviceEnumerator();
foreach (var endpoint in
enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active))
{
Console.WriteLine("{0} ({1})", endpoint.FriendlyName, endpoint.ID);
if (endpoint.FriendlyName.Contains("Azure Kinect Microphone Array"))
{
speechConfig = SpeechConfig.FromSubscription("xxx", "xxx");
speechConfig.SpeechRecognitionLanguage = "zh-CN";
MicrophoneCoordinates[] microphoneCoordinates = new MicrophoneCoordinates[7]
{
new MicrophoneCoordinates(0, 0, 0),
new MicrophoneCoordinates(40, 0, 0),
new MicrophoneCoordinates(20, -35, 0),
new MicrophoneCoordinates(-20, -35, 0),
new MicrophoneCoordinates(-40, 0, 0),
new MicrophoneCoordinates(-20, 35, 0),
new MicrophoneCoordinates(20, 35, 0)
};
var microphoneArrayGeometry = new MicrophoneArrayGeometry(MicrophoneArrayType.Planar, 70, 110, microphoneCoordinates);
audioProcessingOptions = AudioProcessingOptions.Create(AudioProcessingConstants.AUDIO_INPUT_PROCESSING_ENABLE_DEFAULT, microphoneArrayGeometry, SpeakerReferenceChannel.LastChannel);
audioInput = AudioConfig.FromMicrophoneInput(endpoint.ID, audioProcessingOptions);
recognizer = new SpeechRecognizer(speechConfig, audioInput);
initial = true;
break;
}
}
if (!initial)
{
Console.WriteLine("initial error no device");
return;
}
// Subscribes to events.
recognizer.Recognizing += (s, e) =>
{
Console.WriteLine($"RECOGNIZING: Text={e.Result.Text}");
};
recognizer.Recognized += (s, e) =>
{
if (e.Result.Reason == ResultReason.RecognizedSpeech)
{
Console.WriteLine($"RECOGNIZED: Text={e.Result.Text}");
}
else if (e.Result.Reason == ResultReason.NoMatch)
{
Console.WriteLine($"NOMATCH: Speech could not be recognized.");
}
};
recognizer.Canceled += (s, e) =>
{
Console.WriteLine($"CANCELED: Reason={e.Reason}");
if (e.Reason == CancellationReason.Error)
{
Console.WriteLine($"CANCELED: ErrorCode={e.ErrorCode}");
Console.WriteLine($"CANCELED: ErrorDetails={e.ErrorDetails}");
Console.WriteLine($"CANCELED: Did you update the subscription info?");
}
};
recognizer.SessionStarted += (s, e) =>
{
Console.WriteLine("\nSession started event.");
};
recognizer.SessionStopped += (s, e) =>
{
Console.WriteLine("\nSession stopped event.");
Console.WriteLine("\nStop recognition.");
};
Task task = recognizer.StartContinuousRecognitionAsync();
Task.WhenAll(task).Wait();
Thread.Sleep(200000);
}
Where is Start angle 70, End angle 110?