Coder Social home page Coder Social logo

Comments (5)

wenkesj avatar wenkesj commented on May 25, 2024

Android

To save the voice, you would need to capture the raw audio signal, that would require a very simple pull request actually!

According to a quick stack overflow search:
https://stackoverflow.com/a/16340756
"You can use the "buffer received" callback..."

This can be updated for the Android API in the following steps:

  1. Visit this method in the source code
  2. Convert the byte[] buffer passed from onBufferReceived(byte[] buffer) to a readable React Native buffer as a local variable
  3. Add the buffer to the WritableMap object event. This would be similar to the error object event.putBoolean("error", false);, except you would add event.put<Insert Type Here>("buffer", buffer);.
  4. Test it with the example app by reflecting your use case using the Voice.onSpeechRecognized event listener. Every callback concatenate the received event.bytes with a global array variable and then finally writing the contents to a file (This might require another library to write to a file similar to node fs).
  5. You can possibly interface with other libraries such as react-native-audio-toolkit to read the file after you saved it.

Good Luck! I would love to see this implemented :)

from voice.

ohtangza avatar ohtangza commented on May 25, 2024

For iOS, it seems that there is no port we can access the low buffer of PCM. I'll give it a try when I have some time.

from voice.

wenkesj avatar wenkesj commented on May 25, 2024

@ohtangza I recognized your fork is ahead of the main repo, I cherry-picked some of your commits and am planning on merging them so you can stay up-to date as well as everyone else.

I am keeping some of the extra changes you made with tracking break-points in sentences, I think that adds some value to most apps with no performance disadvantages.

Another note is that I added a configuration option for Android clients for the RecognizerIntent on start.

from voice.

wenkesj avatar wenkesj commented on May 25, 2024

@ohtangza is that okay? I will credit you as well as give you full access repository.

from voice.

ohtangza avatar ohtangza commented on May 25, 2024

@wenkesj Oh, I think it's okay for you to cherry-pick our changes. Although we are using it for our app now, I'm not sure this satisfies the level of public use for distribution.

I think you can add a remote repo from your side and apply conditional cherry pick commits if you want. If I am not right, please let me know. Ah, one more thing, regarding getting buffer from Recognizer, we tried but it seems that the recent version of Android does not guarantee the callback to be fired, so we stopped there. Please let us updated if you make a another process on this issue.

@ghsdh3409 Put you in the loop because you also work on our forked repo.

from voice.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.