Critical fix for recognition logic to prevent duplicate processing:
1. Problem Identified:
- _recognitionTimer was repeatedly calling decode() on same audio data
- Same recognition results were being sent multiple times to UI
- Caused redundant processing and potential performance issues
2. Solution Implemented:
- Add _lastRecognizedText state variable to track previous results
- Only send recognition results when text content actually changes
- Reset _lastRecognizedText when starting new recording session
3. Logic Changes:
- Enhanced recognition loop with duplicate detection:
A command-line utility for Dart development.
Usage: dart <command|dart-file> [arguments]
Global options:
-v, --verbose Show additional command output.
--version Print the Dart SDK version.
--enable-analytics Enable analytics.
--disable-analytics Disable analytics.
--suppress-analytics Disallow analytics for this `dart *` run without changing the analytics configuration.
-h, --help Print this usage information.
Available commands:
analyze Analyze Dart code in a directory.
compile Compile Dart to various formats.
create Create a new Dart project.
devtools Open DevTools (optionally connecting to an existing application).
doc Generate API documentation for Dart projects.
fix Apply automated fixes to Dart source code.
format Idiomatically format Dart source code.
info Show diagnostic information about the installed tooling.
pub Work with packages.
run Run a Dart program.
test Run tests for a project.
Run "dart help <command>" for more information about a command.
See https://dart.dev/tools/dart-tool for detailed documentation.
- Added debug logging for skipped duplicate results
- Reset state on startListening() to ensure clean slate
4. Benefits:
- Eliminates duplicate recognition results sent to UI
- Reduces unnecessary computation and network overhead
- Improves user experience with cleaner, non-repetitive updates
- Better resource utilization and battery life
This fix addresses the core issue where the recognition timer was
processing the same audio stream content repeatedly, ensuring each
unique recognition result is only sent once to the application.
|
||
|---|---|---|
| .. | ||
| src | ||
| yx_asr.dart | ||