react-native-voice / voice Goto Github PK
View Code? Open in Web Editor NEW:microphone: React Native Voice Recognition library for iOS and Android (Online and Offline Support)
License: MIT License
:microphone: React Native Voice Recognition library for iOS and Android (Online and Offline Support)
License: MIT License
and i got error massage in xcode console
[avae] AVAEInternal.h:69:_AVAE_Check: required condition is false: [AVAEGraphNode.mm:804:CreateRecordingTap: (nullptr == Tap())]
*** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: nullptr == Tap()'
*** First throw call stack:
(0x1841dfd38 0x1836f4528 0x1841dfc0c 0x1898ed634 0x1898ecc7c 0x18992ec18 0x189919064 0x189991a78 0x18998238c 0x1050b9ca8 0x1050bbed0 0x10587549c 0x10587545c 0x10588156c 0x105886b54 0x105886880 0x183e0b130 0x183e0ac30)
libc++abi.dylib: terminating with uncaught exception of type NSException
anyone have solution for this? thanks
i am using real device, iphone 7plus, ios 11 to test.
Hi there!
First, congratulations this library looks really cool. Good work!
I have problems in iOS though.
"Failed to load bundle" with error (Error reading bundle) ... main.jsbundle(null)
Any ideas?
Hi there,
This is a superb module. Thank you for it. On Android, the recording auto-stops after silence comes in. On iOS though, it does not auto-stop on silence.
To have parity between the platforms can we please request an "option to auto-stop on silence" for both platforms.
Hi there, thanks for this awesome lib. What is the minimum android version? RN supports down to 4.1.
This lib works well in Android.
As my debug, Voice.onSpeechStart(event) is triggered but Voice.onSpeechRecognized(event) is not called.
I'm using:
react-native-voice: 0.1.12
react: 16.0.0-alpha.12
react-native: 0.46.4
Regards!
I am using Android 6 for testing. However after I do Voice.start()
and it returns undefined
I then speak and it trigger onSpeechError
with error
being { message: "4/error from server" }
.
May you please advise.
Here is my component:
// @flow
import React, { PureComponent } from 'react'
import { Button, PermissionsAndroid, Text, View } from 'react-native'
import Voice from 'react-native-voice'
import styles from './styles'
class VoiceButton extends PureComponent {
state = {
isRecording: false,
partial: '',
result: ''
}
componentDidUpdate(propsOld, stateOld) {
const { isRecording } = this.state;
const { isRecording:isRecordingOld } = stateOld;
if (isRecording !== isRecordingOld) {
if (isRecording) this.voiceStart()
else this.voiceStop();
}
}
componentWillUnmount() {
this.voiceDestroy();
}
render() {
const { partial, result, isRecording } = this.state;
return (
<View style={styles.container}>
<View>
<Text>{isRecording ? 'Listening...' : 'Press and hold button then speak'}</Text>
</View>
<Button title="Record" onPress={this.handlePress} />
<View>
<Text>PARTIAL RESULTS</Text>
<Text>{partial}</Text>
</View>
<View>
<Text>RESULT</Text>
<Text>{result}</Text>
</View>
</View>
)
}
handlePress = () => this.setState(({ isRecording }) => ({ isRecording:!isRecording }))
voiceStart = async () => {
this.setState(() => ({ result:'', partial:'' }));
console.log('Voice.isAvailable():', await Voice.isAvailable());
try {
const didGrant = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.RECORD_AUDIO, { title:'Microphone Permission', message:'Enter the Gunbook needs access to your microphone so you can search with voice.' });
console.log('didGrant:', didGrant);
if (didGrant !== PermissionsAndroid.RESULTS.GRANTED) {
console.log('you denied permission');
return;
}
} catch(err) {
console.error('failed getting permission, err:', err.message);
return;
}
// Voice.onSpeechStart = this.handleSpeechStart;
// Voice.onSpeechRecognized = this.handleSpeechRecognized;
// Voice.onSpeechEnd = this.handleSpeechEnd;
Voice.onSpeechError = this.handleSpeechError;
Voice.onSpeechResults = this.handleSpeechResults;
Voice.onSpeechPartialResults = this.handleSpeechPartialResults;
// Voice.onSpeechVolumeChanged = this.handleSpeechVolumeChanged;
try {
const started = await Voice.start('en');
console.log('started:', started);
} catch(err) {
console.error('Failed to start, err:', err);
}
}
voiceStop = async () => {
try {
const stopped = await Voice.stop();
console.log('stopped:', stopped);
} catch(err) {
console.error('Failed to stop, err:', err);
}
}
voiceCancel = async () => {
try {
await Voice.cancel();
} catch(err) {
console.error('Failed to cancel, err:', err);
}
}
voiceDestroy = async () => {
try {
const destroyed = await Voice.destroy();
console.log('destroyed:', destroyed);
Voice.removeAllListeners(destroyed);
} catch(err) {
console.error('Failed to destroy, err:', err);
}
}
// handleSpeechStart =
// handleSpeechRecognized =
// handleSpeechEnd =
handleSpeechError = ({ error }) => console.error('speech recording error:', error);
handleSpeechResults = ({ value }) => this.setState(() => ({ result:value }));
handleSpeechPartialResults = ({ value }) => this.setState(() => ({ partial:value }));
}
export default VoiceButton
I have two apps that use voice. The first one the users are saying one of 300 items. Is it possible to limit the voice recognition to only return closest elements to ones in an array?
In another application, the users are saying a single number, or multiple numbers. Anyway to limit to just numbers?
Hello, how do you make the implementation speech recognize the voice in the background? No need to push the button, and it recognizes key words
Hi,
First of all thanks for sharing this plugin. I am using following react-native, Does your module work in these versions.
react-native-cli: 2.0
react-native: 0.41.2
If NO how do I run your plugin in mentioned react-native?
I start speech.It is working voice.start() but stop is not working.
Hi, would it be possible to provide text-to-speech while offline, at least for android? I'm not a native developer, but this:
https://developer.android.com/reference/android/speech/RecognizerIntent.html#EXTRA_PREFER_OFFLINE
should do the trick, right?
Hello, I tried to use react-native-voice and it works perfectly. But now I would like to use it with french. I replace en-US with fr-FR in Voice.start('en-US') but it doesn't works at all (except if I speak english).
Hi, I'm getting an error while starting up speech recognition on an iPad Air 2. Not sure what is causing the issue.
"device": {
"family": "iOS",
"arch": "arm64",
"storage_size": 63989493760,
"free_memory": 51675136,
"memory_size": 2084569088,
"boot_time": "2017-11-13T07:29:50Z",
"model": "iPad5,4",
"usable_memory": 1687126016,
"type": "device"
},
"os": {
"rooted": false,
"kernel_version": "Darwin Kernel Version 17.2.0: Fri Sep 29 18:14:52 PDT 2017; root:xnu-4570.20.62~4/RELEASE_ARM64_T7001",
"version": "11.1.1",
"build": "15B150",
"type": "os",
"name": "iOS"
}
Application threw exception com.apple.coreaudio.avfaudio: required condition is false: IsFormatSampleRateAndChannelCountValid(format)
Originated at or in a subcall of folly::Expected<long long, folly::ConversionCode> folly::detail::str_to_integral<long long>(folly::Range<char const*>*)
Awesome module! Is it possible to play a sound or speak text? If I use this module together with react-native-audio-toolkit it crashes(iOS) when I want to play a sound in my App.
Thanks for your support
In Android SpeechRecognizer emits (horrible) BIP sound when starting and ending recognition.
This by design but it would be awesome to be able to remove / mute these bips.
dont work auto stop in ios?
IOS,
react-native: 0.48.2,
react-native-voice: 0.2.1,
Hi
So basically when i try to call Voice.stop() without any recognized voice i receive Error (203/Retry).
But if i have at least 1 recognized word Voice.stop() works fine
Voice is undefined
https://github.com/wenkesj/react-native-voice/blob/master/index.js#L8
Voice.stop()
and silence during a recording do trigger Voice.handleSpeechEnd
. However Voice.cancel()
is not.
Bonus: It would be even cooler if handleSpeechEnd e
would include reason
of cancelled
or silence
or stopped
.
Using Android 6.
It seems that the voice detecting function will terminate after starting detection a few seconds. Is there exist a way to keep listening to user input?
Thanks!
I want to save the user's voice while recognizing it. Is it possible with this library?
Hi,
Is possible to use this library with app on background?
Thank you
Anyone know why it would only capture the first word? It is working fine on Android this issue is only occurring on iOS. I am not sure if it is only returning the first word, or is stopping listening after the first word is recognized.
Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.
Above was the issue I got when I try to navigate::goBack and play the mic button again. I'm not sure why the states we define on contruct is having an issue it already bind functions, is there missing function on this list? (I copied it on the example you provided)
Voice.onSpeechStart = this.onSpeechStart.bind(this);
Voice.onSpeechRecognized = this.onSpeechRecognized.bind(this);
Voice.onSpeechEnd = this.onSpeechEnd.bind(this);
Voice.onSpeechError = this.onSpeechError.bind(this);
Voice.onSpeechResults = this.onSpeechResults.bind(this);
Voice.onSpeechPartialResults = this.onSpeechPartialResults.bind(this);
Voice.onSpeechVolumeChanged = this.onSpeechVolumeChanged.bind(this);
Could you please guide me if you have come across this issue?
Thanks,
Hello, thanks for this handy library, i there a way to provide a fallback error when using this library for ios 8, 9 instead of crashing due SO support? this way we can use this library for ios +10 but also we can include it optionally for lower versions.
I have built the VoiceTest project successfully.
I have run on ios-simulator.
But the app does not recognize my voice, so timeout error was issued.
Help me! Thanks.
Hi,
I tried to install this package but something wrong append when I build :
I've link the package with :
react-native link react-native-voice
and i've update the gradle settings & the gardle build correctly
and this build return :
Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'com.wenkesj.voice'
What should i do to fix that ?
Tanks
Hi,
I read that this react-native-voice provides Online and Offline Support.
Does this mean that it can work offline?
I tested it and it keeps popping network error when I try offline on my AVD.
Any thoughts?
Thanks
Did React-native-voice is compatible with Google offline speech recognition?
Hi All,
After complete the speech is it possible to get audio file like .mp3 file?
Thanks in advance
Hi,
Is it possible to pause the voice?
Hello! Does this library recognize speech and converts it to text in real-time? I mean when I say "one" and then pause for 1 second and then say "two". Will those two words trigger two separate callbacks?
There are at least 2 events that potentially does what I want to accomplish:
Which one of these gets executed every time a single word is recognized? Thanks!
Hi,
I'm having this issue about this module. This code
Voice.onSpeechStart = this.onSpeechStart.bind(this);
Voice.onSpeechRecognized = this.onSpeechRecognized.bind(this);
Voice.onSpeechEnd = this.onSpeechEnd.bind(this);
Voice.onSpeechError = this.onSpeechError.bind(this);
Voice.onSpeechResults = this.onSpeechResults.bind(this);
Voice.onSpeechPartialResults = this.onSpeechPartialResults.bind(this);
Voice.onSpeechVolumeChanged = this.onSpeechVolumeChanged.bind(this);
is causing the bind issue on the constructor(props)
is there a way to fix this issue?
thanks,
when i install this package and a call on button press: await Voice.start("en-US");
Genymotion cause this error
Any helps.
can you teach me run your example
Guys please help after install not open project in emulator and real device(
Library not loaded: /System/Library/Frameworks/Speech.framework/Speech
i have run ios success, but android can not start, the error is:
ExceptionsManager.js:73 Error: Service not registered: android.speech.SpeechRecognizer$Connection@8d30714
at callback (index.js:61)
at MessageQueue.__invokeCallback (MessageQueue.js:354)
at MessageQueue.js:129
at MessageQueue.__guard (MessageQueue.js:269)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:128)
at t (RNDebuggerWorker.js:1)
Can we provide a short audio file (.mp3) as an input to react-native-voice and get the corresponding text?
Since it does not allow to save the audio file, we need to use the audio file later as well.
Just tried running the example app and when calling the Stop/Cancel or Destroy methods, I'm getting:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]'
libc++abi.dylib: terminating with uncaught exception of type NSException
in
React/Executors/RCTJSCExecutor.mm
on line:
while (kCFRunLoopRunStopped != CFRunLoopRunInMode(kCFRunLoopDefaultMode, ((NSDate *)[NSDate distantFuture]).timeIntervalSinceReferenceDate, NO)) {
Has anyone else come across this bug?
Start recognize work fine and destroy, but if i try cancel on stop i get error:
216/The operation couldn’t be completed. (kAFAssistantErrorDomain error 216.)
System ios 11.2
Any possibility of adding support for setting intent parameters like:
• EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS
• EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS
• EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS
...in VoiceModule.startSpeech() in order to control things such as the length of the speech capture?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.