csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
354 stars 218 forks source link

IOS App Crashes when it detects the speech #372

Closed vasanthbalaji88 closed 1 year ago

vasanthbalaji88 commented 1 year ago

[avae] AVAEInternal.h:76 required condition is false: [AVAEGraphNode.mm:826:CreateRecordingTap: (nullptr == Tap())] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: nullptr == Tap()'

Im always getting error , when i speak something and when it detects ,it crashes the app

sowens-csd commented 1 year ago

What iOS version and device are you using?

vasanthbalaji88 commented 1 year ago

@sowens-csd IOS version is 16.2 and device is Iphone Xr

sowens-csd commented 1 year ago

Does it do this in the example app? Do you have any bluetooth or wired headphones connected?

vasanthbalaji88 commented 1 year ago

I haven't tried with example app, but i didn't connect any bluetooth Or wired headphones. But i copied the contents from example app for speech recognition.

sowens-csd commented 1 year ago

Thanks, I have the same phone and iOS 16.3.1 and cannot reproduce the problem. I can successfully recognize text in the example app. Are you using any other plugins in your app or is it just the standard example app?

I'll try some searches on the error log and see if I can find any likely causes.

sowens-csd commented 1 year ago

This looks like it might be related: https://developer.apple.com/forums/thread/51935

The cause seems to be adding a tap without removing an existing tap first. Can you get the failure on the first attempt to listen for voice or does it only happen on subsequent attempts? Are there any other speech, voice, or sound plugins in use in the app? My theory is that something (either STT itself or some other plugin) is tapping the input bus to listen and then not removing the tap before STT next tries to start listening. Since I can't reproduce the problem there might be something about how you're using it that is different from what I'm doing. Can you give me any reproduction steps that might help?

vasanthbalaji88 commented 1 year ago

@sowens-csd I checked the link you sent, yes im using another plugin https://pub.dev/packages/tflite_audio for audio recognition,

first i use tflite audio to recognise audio ,i stop the audio recognition, once it recognises,i start the speech recognition to be listened after audio recognition is stopped, when speech recognition detects the text , i was stopping the speech recognition and start audio recognition(this is stream based audio recognition).

i think this was running in parallely and caused the iOS app crash, now i delayed for some milliseconds and started the audio recognition after stopping speech(so this might be removed the tap by delaying) , it seems to be fine now.

Thanks for your Responses and quick replies , this is great plugin for speech to text. Could you please add this information for other users, who might face this issue now or in future, they should delay some milliseconds to work both packages, they shouldnt be run in parallel.

sowens-csd commented 1 year ago

Thanks for posting your solution, that's really helpful. Yes, I'll add this to the troubleshooting section.