csdcorp / speech_to_text

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

Getting Error 7 after start. #517

Open Anushac97 opened 2 months ago

Anushac97 commented 2 months ago

D/SpeechToTextPlugin(22543): Start listening D/SpeechToTextPlugin(22543): setupRecognizerIntent D/SpeechToTextPlugin(22543): Notify status:listening D/SpeechToTextPlugin(22543): Start listening done D/SpeechToTextPlugin(22543): rmsDB -2.0 / -2.0 D/SpeechToTextPlugin(22543): rmsDB -2.0 / -1.52 D/SpeechToTextPlugin(22543): rmsDB -2.0 / 1.0 D/SpeechToTextPlugin(22543): rmsDB -2.0 / 8.559999 D/SpeechToTextPlugin(22543): rmsDB -2.0 / 10.0 D/SpeechToTextPlugin(22543): rmsDB -2.0 / 10.0 D/SpeechToTextPlugin(22543): Notify status:notListening D/SpeechToTextPlugin(22543): Notify status:doneNoResult D/SpeechToTextPlugin(22543): rmsDB -2.0 / 10.0 D/SpeechToTextPlugin(22543): rmsDB -2.0 / 10.0 D/SpeechToTextPlugin(22543): Error 7 after start at 5370 -2.0 / 10.0

alihuseyin commented 2 months ago

same here

cjbubblz commented 1 month ago

Same here

wamynobe commented 1 month ago

can your share your flutter doctor -v, a minimum example and the device's model?

daniilaksonov92 commented 1 month ago

Same here

[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-UA) • Flutter version 3.19.6 on channel stable at /Users/admin/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 54e66469a9 (4 weeks ago), 2024-04-17 13:08:03 -0700 • Engine revision c4cd48e186 • Dart version 3.3.4 • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/admin/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15E204a • CocoaPods version 1.15.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] Connected device (1 available) • Mi 9 Lite (mobile) • 17dcbbd9 • android-arm64 • Android 10 (API 29)

[✓] Network resources • All expected network resources are available.

• No issues found!

daniilaksonov92 commented 1 month ago

await speech.initialize( onError: errorListener, onStatus: statusListener, debugLogging: _logEvents, finalTimeout: Duration(seconds: finalTimeout), );

speech.listen( onResult: resultListener, listenFor: Duration(seconds: finalTimeout + 10), pauseFor: Duration(seconds: finalTimeout + 10), localeId: _currentLocaleId, listenOptions: SpeechListenOptions( listenMode: ListenMode.dictation, onDevice: false, partialResults: true, cancelOnError: true, ), );

LOGS: 
I/flutter (28007): android microStatus: PermissionStatus.granted

D/SpeechToTextPlugin(28007): Start initialize D/SpeechToTextPlugin(28007): Checked permission D/SpeechToTextPlugin(28007): has permission, completing D/SpeechToTextPlugin(28007): completeInitialize D/SpeechToTextPlugin(28007): Testing recognition availability D/SpeechToTextPlugin(28007): sending result D/SpeechToTextPlugin(28007): leaving complete D/SpeechToTextPlugin(28007): leaving initializeIfPermitted D/SpeechToTextPlugin(28007): before setup intent D/SpeechToTextPlugin(28007): setupRecognizerIntent D/SpeechToTextPlugin(28007): after setup intent D/SpeechToTextPlugin(28007): Start listening D/SpeechToTextPlugin(28007): setupRecognizerIntent D/SpeechToTextPlugin(28007): Notify status:listening D/SpeechToTextPlugin(28007): Start listening done D/SpeechToTextPlugin(28007): Creating recognizer D/SpeechToTextPlugin(28007): Setting default listener D/SpeechToTextPlugin(28007): In RecognizerIntent apply D/SpeechToTextPlugin(28007): put model D/SpeechToTextPlugin(28007): put package D/SpeechToTextPlugin(28007): put partial D/SpeechToTextPlugin(28007): In RecognizerIntent apply D/SpeechToTextPlugin(28007): put model D/SpeechToTextPlugin(28007): put package D/SpeechToTextPlugin(28007): put partial D/SpeechToTextPlugin(28007): put languageTag D/SpeechToTextPlugin(28007): Error 3 after start at 2003 1000.0 / -100.0 ( sometimes appears Error 7 ) D/SpeechToTextPlugin(28007): Notify status:notListening D/SpeechToTextPlugin(28007): Notify status:doneNoResult I/flutter (28007): SpeechRecognitionError msg: error_audio_error, permanent: true

The second try:

I/flutter (28007): android microStatus: PermissionStatus.granted I/flutter (28007): START LISTENER D/SpeechToTextPlugin(28007): before setup intent D/SpeechToTextPlugin(28007): setupRecognizerIntent D/SpeechToTextPlugin(28007): after setup intent D/SpeechToTextPlugin(28007): Start listening D/SpeechToTextPlugin(28007): setupRecognizerIntent D/SpeechToTextPlugin(28007): Notify status:listening D/SpeechToTextPlugin(28007): Start listening done D/SpeechToTextPlugin(28007): Creating recognizer D/SpeechToTextPlugin(28007): Setting default listener D/SpeechToTextPlugin(28007): In RecognizerIntent apply D/SpeechToTextPlugin(28007): put model D/SpeechToTextPlugin(28007): put package D/SpeechToTextPlugin(28007): put partial D/SpeechToTextPlugin(28007): In RecognizerIntent apply D/SpeechToTextPlugin(28007): put model D/SpeechToTextPlugin(28007): put package D/SpeechToTextPlugin(28007): put partial D/SpeechToTextPlugin(28007): put languageTag D/SpeechToTextPlugin(28007): rmsDB -2.0 / -2.0 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 3.6399999 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 3.6399999 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 3.6399999 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 3.88 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 4.0 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 4.0 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 4.84 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 4.84 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 5.7999997 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 5.7999997 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 9.5199995 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 9.5199995 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 9.5199995 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 9.5199995 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 9.5199995 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 9.5199995 D/SpeechToTextPlugin(28007): rmsDB -2.0 / 10.0 D/SpeechToTextPlugin(28007): Stop listening D/SpeechToTextPlugin(28007): Notify status:notListening D/SpeechToTextPlugin(28007): Notify status:doneNoResult D/SpeechToTextPlugin(28007): Stop listening done D/SpeechToTextPlugin(28007): rmsDB -2.0 / 10.0 D/SpeechToTextPlugin(28007): Recognizer destroy

Device: Xiaomi Mi 9 Lite • android-arm64 • Android 10 (API 29)

daniilaksonov92 commented 1 month ago

in these cases there are no recognized words

@wamynobe

wamynobe commented 1 month ago

Sorry for late response. I tried to run example code on a Xiaomi device with MIUI 13.0.10 and Android 11. The example worked as expected. I will take a closer look on this issue when I receive a new Xiaomi device (may be in a couple of weeks).

Example ```dart import 'package:flutter/material.dart'; import 'package:speech_to_text/speech_to_text.dart'; void main() => runApp(const SpeechSampleApp()); class SpeechSampleApp extends StatefulWidget { const SpeechSampleApp({Key? key}) : super(key: key); @override State createState() => _SpeechSampleAppState(); } class _SpeechSampleAppState extends State { final SpeechToText speech = SpeechToText(); var _isInitialized = false; var _data = ''; @override void initState() { super.initState(); _init(); } void _init() async { await speech.initialize( finalTimeout: const Duration(seconds: 5), ); if (!mounted) return; setState(() { _isInitialized = true; }); } void _startListen() { speech.listen( onResult: (rs) { print(rs); setState(() { _data = rs.recognizedWords; }); }, listenFor: Duration(seconds: 15), pauseFor: Duration(seconds: 15), listenOptions: SpeechListenOptions( listenMode: ListenMode.dictation, onDevice: false, partialResults: true, cancelOnError: true, ), ); } @override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( title: const Text('Speech to Text Example'), ), body: Column(children: [ Text('data: $_data'), if (!_isInitialized) const Center( child: CircularProgressIndicator(), ), if (_isInitialized) ElevatedButton( onPressed: _startListen, child: const Text('Start Listening'), ), ]), ), ); } } ```