Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Basic SpeechRecognizerScreen #201

Closed
wants to merge 39 commits into from
Closed

Conversation

BadrTad
Copy link
Contributor

@BadrTad BadrTad commented Apr 1, 2022

This PR is more of a proof of concept for android speech recognition library with JetPack Compose.

Some key features

  • Ask for persmission if not already granted by the user to use the mic

  • Instanciate SpeechRecognizer (as Intent) and listen for results (event based/callback) when user hit mic icon.

  • Use cancellableCourotine to execute start listening with SpeechRecognizer.

  -Integrate SpeechRecognizer(callback) in JetPackCompose (using flows)
@BadrTad BadrTad added the update-me-please Right to update current branch with main label Apr 1, 2022
@BadrTad BadrTad marked this pull request as ready for review April 1, 2022 18:33
@BadrTad BadrTad enabled auto-merge (squash) April 1, 2022 18:33
@KurohanaJuri
Copy link
Contributor

I try on my phone, it seems not working, maybe I miss something ?

  • On the Speech Recognizer Screen, I click on the mic button
  • It asks me to give the permission, I accept
  • On the screen, I click on the mic, It says it's listening
  • I say something, but nothing happened :(

Copy link
Contributor

@alexandrepiveteau alexandrepiveteau left a comment

Choose a reason for hiding this comment

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

Great start ! Imho it would be interesting to see how much of the permission logic could be extracted to a dedicated state / ViewModel, which will help us test the feature more efficiently.

Also, I'd be interested in knowing if there's a way for the app to continuously listen for voice recognition results (maybe using the partial results like in https://gist.github.com/alexandrepiveteau/b35785ea527f6c5cb46abe47fc2c5ab9 ?).

@BadrTad
Copy link
Contributor Author

BadrTad commented Apr 3, 2022

@alexandrepiveteau Yes there is a way to setup a SEGMENTED_SESSION where the Speechrecognizer produces partial results. Timeouts can also be set in the Intent to determine how long the session lasts and delays between speeches.

  - Delete unused class
  - Rename dependency in toml
  - Add comment about route
  - Refactor to MaxResultsCount
  - use rememberCoroutineScope
@BadrTad
Copy link
Contributor Author

BadrTad commented Apr 3, 2022

@KurohanaJuri, it was working fine on my phone. Would you try with this new version of the code ? Let me know if it's buggy or no results show up.

@BadrTad
Copy link
Contributor Author

BadrTad commented Apr 3, 2022

I also noticed something odd with the recognizer : One have to start talking right away or just a few (2 or 3) seconds after clicking the button, otherwise, the recognizer don't halt and one has to deactivate and reactivate the mic again.

Copy link
Contributor

@matt989253 matt989253 left a comment

Choose a reason for hiding this comment

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

A few minor things, the rest looks good to me!

@codeclimate
Copy link

codeclimate bot commented Apr 7, 2022

Code Climate has analyzed commit 2246da6 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 79.3% (80% is the threshold).

This pull request will bring the total coverage in the repository to 96.2% (-0.5% change).

View more on Code Climate.

@BadrTad BadrTad self-assigned this Apr 7, 2022
@BadrTad BadrTad linked an issue Apr 7, 2022 that may be closed by this pull request
@alexandrepiveteau
Copy link
Contributor

(now included in #301)

@BadrTad BadrTad closed this May 5, 2022
auto-merge was automatically disabled May 5, 2022 15:10

Pull request was closed

@alexandrepiveteau alexandrepiveteau deleted the feature/bt/speech_recognition branch June 9, 2022 21:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
update-me-please Right to update current branch with main
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simple prototype of voice recognition
4 participants