Is your feature request related to a problem? Please describe.
When user start to speak, I want to do some animation which depends on the audio level of mic input.
When user speak louder o r lower, the animation will be different, maybe a simple wave
Describe the solution you'd like
I think it is not difficult to calculate the audio level during recording, maybe something like:
for (int i = 0; i < buffer.length; i++) {
v += buffer[i] * buffer[i];
}
double mean = v / (double) r;
double volume = 10 * Math.log10(mean);
Then application can add listener to the event like:
speechRecognizer.volume.addEventListener( (o, event) => { event.audioLevel })
Is it possible?
Thanks a lot.
@jhakulin can you please comment on @jzhw0130 's question?
@jzhw0130 Currently SDK does not support this, but you may achieve the functionality if you use external microphone steam e.g. as in sample: https://github.com/microsoft/botframework-solutions/blob/master/samples/android/clients/VirtualAssistantClient/directlinespeech/src/main/java/com/microsoft/bot/builder/solutions/directlinespeech/MicrophoneStream.java
and then you do mic audio level visualization in your app side.
Also look at following sample which does the same in Unity side
https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/unity/from-unitymicrophone/Assets/Scripts/HelloWorld.cs
In the future releases we are adding capability to stream audio back from the speech sdk, which enables you the same. I am closing this, let us know if more information is required
@oscholz @jhakulin
cool.
Thanks for you guys.
Works perfectly.
Most helpful comment
@jzhw0130 Currently SDK does not support this, but you may achieve the functionality if you use external microphone steam e.g. as in sample: https://github.com/microsoft/botframework-solutions/blob/master/samples/android/clients/VirtualAssistantClient/directlinespeech/src/main/java/com/microsoft/bot/builder/solutions/directlinespeech/MicrophoneStream.java
and then you do mic audio level visualization in your app side.
Also look at following sample which does the same in Unity side
https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/samples/unity/from-unitymicrophone/Assets/Scripts/HelloWorld.cs
In the future releases we are adding capability to stream audio back from the speech sdk, which enables you the same. I am closing this, let us know if more information is required