Skip to content

Conversation

@VladislavAntonyuk
Copy link
Collaborator

@VladislavAntonyuk VladislavAntonyuk commented Mar 2, 2025

Description of Change

Linked Issues

PR Checklist

Additional information

Untitled.video.2.mp4

Copilot AI review requested due to automatic review settings March 2, 2025 20:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR fixes issues related to speech recognition support across multiple platforms by updating API usages and converting several void methods to asynchronous Tasks. Key changes include updating Android platform version requirements and adding asynchronous support with task-based patterns, as well as corresponding updates in macOS, iOS, .NET, Windows, and Tizen implementations.

Reviewed Changes

File Description
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.android.cs Converted InternalStartListening to async Task, updated Android version requirements, and added task-based callbacks for on-device language model download.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/SpeechToTextImplementation.android.cs Updated language configuration and switched to async Task for InternalStartListening.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.macos.cs Changed InternalStartListening to asynchronous, returning Task.CompletedTask.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.ios.cs Converted InternalStartListening to async Task and returned Task.CompletedTask.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.net.cs Updated InternalStartListening signature to Task and preserved unsupported behavior.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.windows.cs Changed InternalStartListening to async Task with Task.CompletedTask return.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.tizen.cs Updated InternalStartListening to async Task with Task.CompletedTask return.
src/CommunityToolkit.Maui.Core/Essentials/SpeechToText/OfflineSpeechToTextImplementation.shared.cs Updated the StartListenAsync method to await the asynchronous InternalStartListening implementation.

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

@VladislavAntonyuk VladislavAntonyuk self-assigned this Mar 2, 2025
@VladislavAntonyuk VladislavAntonyuk requested a review from a team March 2, 2025 20:38
@VladislavAntonyuk VladislavAntonyuk enabled auto-merge (squash) March 2, 2025 22:27
@VladislavAntonyuk VladislavAntonyuk added needs discussion Discuss it on the next Monthly standup and removed needs discussion Discuss it on the next Monthly standup labels Mar 6, 2025
@ne0rrmatrix
Copy link
Contributor

ne0rrmatrix commented Mar 7, 2025

I have found a bug with windows implementation of Speech to text page. If you run the app and test speech to text and then close the app it crashes to desktop. Current main does not do this. But current main also does not work for me at all with speech recognition in any language.

2025-03-07.03-04-37.mp4

edit: I tested it again and if I use speech to text and then leave page and then exit app it still crashes 100 percent of the time.

@VladislavAntonyuk
Copy link
Collaborator Author

@ne0rrmatrix there is an open issue for that. not related to this PR.

Copy link
Contributor

@ne0rrmatrix ne0rrmatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On windows the changes do exactly what is intended. The offline speech recognition works. the online speech recognition works. Current main I cannot get either offline or online speech recognition to work with windows.
On android I have zero issues with using this PR. I have been unable to test other languages specifically as I only speak English.

So this is a great fix! I have seen a bug in windows where the app crashes 100 percent of the time if you use online speech recognition. But once that is fixed I think this will be good to go!

@VladislavAntonyuk
Copy link
Collaborator Author

This one is primarily the Android-only fix. This issue #1894 will be fixed in another PR

@ne0rrmatrix
Copy link
Contributor

This one is primarily the Android-only fix. This issue #1894 will be fixed in another PR

I tested the android version. It is working 100 percent for me with this PR. But I am unable to test other languages because I only speak english. It actually works better on android than on windows. Most likely due to my Mic is not configured properly for silence detection on windows. I have multiple mics on windows and the one I use daily is an xlr mic with a usb interface and I use Nvidia software interface on top of that. So an edge case that also works! If you need anyone to test another language I cannot help. But for what I was able to test everything works On android and windows. If anyone can confirm the language packs working I will be happy to approve this PR.

@VladislavAntonyuk
Copy link
Collaborator Author

@ne0rrmatrix I attached video in summary demonstration Ukrainian speech recognition

Copy link
Contributor

@ne0rrmatrix ne0rrmatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like another great PR is ready to go! I am happy to approve this PR. I have tested the changes on windows and android. It just works as intended. After looking at the video that @VladislavAntonyuk provided shows other languages I have no concerns.

@VladislavAntonyuk VladislavAntonyuk merged commit b9be360 into main Mar 7, 2025
10 checks passed
@VladislavAntonyuk VladislavAntonyuk deleted the fix-speech-recognition branch March 7, 2025 12:21
@github-actions github-actions bot locked and limited conversation to collaborators Mar 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Polish Language Speech Recognition Not Working [BUG] OfflineSpeechToText Failure: LanguageNotSupported

2 participants