Um pacote Flutter que fornece controle manual sobre a funcionalidade de fala para texto, permitindo escuta contínua com callbacks personalizados de início, pausa, retomada e parada sem pausas automáticas durante pausas na fala.
Orientação gerada a partir de informações públicas. Apenas para referência.
Um pacote Flutter que oferece controle granular sobre o processamento de fala para texto, permitindo captura contínua de áudio sem interrupções automáticas durante pausas na fala. Os desenvolvedores podem iniciar, pausar, retomar e parar manualmente o reconhecimento com callbacks personalizáveis, tornando-o ideal para aplicativos que exigem transcrição ininterrupta. Projetado para uso em assistentes de voz, ferramentas de digitação em tempo real e aplicativos interativos onde uma entrada de áudio sem interrupções é crítica. Suporta múltiplas plataformas, incluindo Android, iOS, Web, macOS, Windows e Linux.
Desenvolvedores que precisam de controle total sobre os processos de STT
Aplicações que exigem reconhecimento de fala ininterrupto
Construtores de assistente de voz
Ferramentas para entrada de voz longa
Aplicativos com lógica personalizada de interação por voz
Considerações
Requer gerenciamento manual do estado
Complexidade maior do que os pacotes de STT com pausa automática
Pode ser necessário um tratamento adicional de erros para casos extremos
Depende de APIs de fala específicas da plataforma
Não é ideal para transcrições simples de uma única vez
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
manual_speech_to_text
A Flutter plugin that enhances the standard speech-to-text functionality by providing manual control over speech recognition, including pause and resume capabilities, and improved continuous listening. This package addresses common issues like automatic stopping during silence and lack of manual control in the standard speech-to-text implementation.
Add the following permission to your Android Manifest (android/app/src/main/AndroidManifest.xml):
<uses-permissionandroid:name="android.permission.RECORD_AUDIO"/><uses-permissionandroid:name="android.permission.INTERNET"/><uses-permissionandroid:name="android.permission.BLUETOOTH"/><uses-permissionandroid:name="android.permission.BLUETOOTH_ADMIN"/><uses-permissionandroid:name="android.permission.BLUETOOTH_CONNECT"/><!-- other tags --><queries><intent><actionandroid:name="android.speech.RecognitionService" /></intent></queries>
The main controller class for managing speech recognition.
Methods
listen({required onListeningStateChanged, required onListeningTextChanged, onSoundLevelChanged}): Set up callbacks for state changes, text recognition, and sound level monitoring
startStt(): Start speech recognition
stopStt(): Stop speech recognition
pauseStt(): Pause speech recognition
resumeStt(): Resume paused speech recognition
dispose(): Clean up resources
Properties
enableHapticFeedback: Enable/disable haptic feedback during recognition
localId: Set the locale for speech recognition (e.g., 'en-US')
Ensure your Android Manifest (android/app/src/main/AndroidManifest.xml) includes:
<uses-permissionandroid:name="android.permission.RECORD_AUDIO"/><uses-permissionandroid:name="android.permission.INTERNET"/><uses-permissionandroid:name="android.permission.BLUETOOTH"/><uses-permissionandroid:name="android.permission.BLUETOOTH_ADMIN"/><uses-permissionandroid:name="android.permission.BLUETOOTH_CONNECT"/><!-- other tags --><queries><intent><actionandroid:name="android.speech.RecognitionService" /></intent></queries>
Best Practices
Resource Management
// Proper disposal in StatefulWidget@overridevoiddispose() {
controller.dispose();
super.dispose();
}
Requires Google Play Services for speech recognition
Works offline for some languages (device-dependent)
iOS (Coming Soon)
Troubleshooting
Common Issues
Microphone Permission
Ensure you've added the RECORD_AUDIO permission in AndroidManifest.xml
Ensure you've added <action android:name="android.speech.RecognitionService" /> tag in AndroidManifest.xml between proper tags
The package handles permission requests, but you might need to handle denied permissions in your app
Recognition Stops Unexpectedly
Check if the device is online
Verify that the locale is properly set
Ensure the app has proper permissions
Recognition Quality Issues
Ensure proper microphone proximity
Check for background noise interference
Verify language settings match spoken language
Performance Optimization
Consider enabling haptic feedback for better user experience
Implement error handling for network connectivity issues
Clear disposed controllers to prevent memory leaks
Beef Sound
On some devices, a beep sound is heard:
At the start (after calling the startStt method).
At the end of the conversation (after calling stopStt or pauseStt methods).
During silence (if the user doesn’t speak for a certain duration, typically around 5 seconds on iOS and 2–3 seconds on Android).
Unfortunately, this behavior is platform-dependent and cannot be overridden.
As per the standard plugin documentation, this is a known limitation and cannot be customized.
Note:
For initial setup, if you need more information, please follow the instructions from the documentation of standard speech_to_text.
If you encounter any challenges or need additional troubleshooting help, don't forget to refer to the standard speech_to_text package for more insights and best practices.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Credits
This package builds upon the speech_to_text package, adding manual control and continuous listening capabilities.