Cognitive-services-speech-sdk: Speech to text conversion seems to handle max 15~16 seconds of audio

Created on 16 Jun 2018  Â·  20Comments  Â·  Source: Azure-Samples/cognitive-services-speech-sdk

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

>
Select any audio wav file longer than 16 seconds. And tried converted files using both option 3 and option 6, but audio of upto 15~16 seconds is recognized and converted into text. The rest of audio is ignored. There is no error message.

Any log messages given by the failure

>

Expected/desired behavior

>
Entire audio file should be converted.

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). Other.
Windows 10 pro

Versions

>

Mention any other details that might be useful

The REST API does mention that it handles max of 15 seconds but longer audio is handled by the SDK. I am using SDK.


Thanks! We'll be in touch soon.

Most helpful comment

sdk for longer audio is in c# is it for python also

Here is some example code on how to use continuous recognition on audio files of arbitrary length:

```python
def speech_recognize_continuous_from_file():
"""performs continuous speech recognition with input from an audio file"""
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
audio_config = speechsdk.audio.AudioConfig(filename=audiofilename)

speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)

done = False

def stop_cb(evt):
    """callback that stops continuous recognition upon receiving an event `evt`"""
    print('CLOSING on {}'.format(evt))
    speech_recognizer.stop_continuous_recognition()
    nonlocal done
    done = True

# Connect callbacks to the events fired by the speech recognizer
speech_recognizer.recognizing.connect(lambda evt: print('RECOGNIZING: {}'.format(evt)))
speech_recognizer.recognized.connect(lambda evt: print('RECOGNIZED: {}'.format(evt)))
speech_recognizer.session_started.connect(lambda evt: print('SESSION STARTED: {}'.format(evt)))
speech_recognizer.session_stopped.connect(lambda evt: print('SESSION STOPPED {}'.format(evt)))
speech_recognizer.canceled.connect(lambda evt: print('CANCELED {}'.format(evt)))
# stop continuous recognition on either session stopped or canceled events
speech_recognizer.session_stopped.connect(stop_cb)
speech_recognizer.canceled.connect(stop_cb)

# Start continuous speech recognition
speech_recognizer.start_continuous_recognition()
while not done:
    time.sleep(.5)

```

All 20 comments

This is the current limitation. We are working on it and will remove this limitation very soon.

Is this the limitation in the REST API or the library?

REST API has similar limitation. In future, we are going to remove this limitation in SDK very soon.

Any updates on this. Otherwise you should change your documentation here.

We are working on it. The next coming release in the next 1-2 weeks will support long-running recognition. Sorry for the inconvenience.

@viveknirkhe, @bluemonk482 - our new 0.5.0 release that should fix this is out now.
Please check out the updated NuGet package https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech and the release notes.

Thanks, Mark

Closing. Please open another issue if things do not work as expected.

Thanks, Mark

Using JS-Browser Quickstart and reading a .wav file with SpeechSDK.AudioConfig.fromWavFileInput(file). The transcriptions stops after 15 seconds. I am not getting an error, it just stops. I am using the 7-day test version and speechRecognitionLanguage = "de-DE" does this have any impact?
Am I doing something wrong?

Hey @lwluc -
as Mark said, please open a new issue for new and unrelated questions in the future.

The sample is using RecognizeOnce ... that limits recognition to 10-15 seconds
see https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechrecognizer?view=azure-node-latest
"recognizeonceasync: recognizeOnceAsync:
Starts speech recognition, and stops after the first utterance is recognized. "

for long running audio you will need to utilize Start/StopRecognize and subscribe to recognition events.
https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechrecognizer?view=azure-node-latest#startcontinuousrecognitionasync

thx
Wolfgang

sdk for longer audio is in c# is it for python also

sdk for longer audio is in c# is it for python also

Here is some example code on how to use continuous recognition on audio files of arbitrary length:

```python
def speech_recognize_continuous_from_file():
"""performs continuous speech recognition with input from an audio file"""
speech_config = speechsdk.SpeechConfig(subscription=speech_key, region=service_region)
audio_config = speechsdk.audio.AudioConfig(filename=audiofilename)

speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)

done = False

def stop_cb(evt):
    """callback that stops continuous recognition upon receiving an event `evt`"""
    print('CLOSING on {}'.format(evt))
    speech_recognizer.stop_continuous_recognition()
    nonlocal done
    done = True

# Connect callbacks to the events fired by the speech recognizer
speech_recognizer.recognizing.connect(lambda evt: print('RECOGNIZING: {}'.format(evt)))
speech_recognizer.recognized.connect(lambda evt: print('RECOGNIZED: {}'.format(evt)))
speech_recognizer.session_started.connect(lambda evt: print('SESSION STARTED: {}'.format(evt)))
speech_recognizer.session_stopped.connect(lambda evt: print('SESSION STOPPED {}'.format(evt)))
speech_recognizer.canceled.connect(lambda evt: print('CANCELED {}'.format(evt)))
# stop continuous recognition on either session stopped or canceled events
speech_recognizer.session_stopped.connect(stop_cb)
speech_recognizer.canceled.connect(stop_cb)

# Start continuous speech recognition
speech_recognizer.start_continuous_recognition()
while not done:
    time.sleep(.5)

```

Leon Romaniuk would like to recall the message, "[Azure-Samples/cognitive-services-speech-sdk] Speech to text conversion seems to handle max 15~16 seconds of audio (#13)".

Thanks @chlandsi , @LeonRomaniuk

Is there a way to tag speakers in the above code provided by @chlandsi ? Please help

you mean identify speakers?
this is currently not supported.

for long running audio you will need to utilize Start/StopRecognize and subscribe to recognition events.
https://docs.microsoft.com/en-us/javascript/api/microsoft-cognitiveservices-speech-sdk/speechrecognizer?view=azure-node-latest#startcontinuousrecognitionasync

@wolfma61 does the SDK support continuous recognition from live audio, similar to RecognizeOnce? Or only from audio files?

works for all audio input, so files, streams and microphone as long as you use continuous recognition (not RecognizeOnce)
thx
Wolfgang

@wolfma61 are there any code samples showing this here?

The sample directory contains sample that do call StartContinuousRecognitionAsync
If they do it from a file, just don't use the file input, default is microphone ...

Was this page helpful?
0 / 5 - 0 ratings