voice
voice copied to clipboard
Stop Recording After Small Pause
After a small pause(silence), react native voice sends a beep and stops recording speech on ANDROID. what is the issue PLEASE HELP
+1
Need to continuously recognize as iOS.
+1
Need to continuously recognize as iOS.
does it work offline ?
+1 Need to continuously recognize as iOS.
does it work offline ?
didn't tested yet on offline and device.
+1 Need to continuously recognize as iOS.
does it work offline ?
didn't tested yet on offline and device.
i tried but it didnt work offline....pease let me know if you find nay way to make it work offline as i need it urgently
@chetanbhadarka how is it working on ios ? are there any issues like we are facing on android like stops recording and background noise etc
@chetanbhadarka how is it working on ios ? are there any issues like we are facing on android like stops recording and background noise etc
I just tested in simulator for the features of this dependency, I can say for me it's working fine. I just test with example code of this repo.
did anyone find any solution that why recording stops when i'm on silent?
u can keep on calling the start recording funciton after every 4 seconds and add the new result wiht the previous result...i did the same and it works fine on ios for some reason lol
u can keep on calling the start recording funciton after every 4 seconds and add the new result wiht the previous result...i did the same and it works fine on ios for some reason lol
I also tested your solution with android but not working properly as expected. As you mention here for iOS, but actually in iOS no need to do anything else. I just started and it's continuously listening and converting into Text. just have issue with Android only.
+1
Is there any update on this? This really sucks
I was looking for a fix for this issue and found one made by Nordsword3m on his fork of the project I haven't tested it yet
https://github.com/react-native-voice/voice/commit/55ed383d268b7c667995069debf3be540b342171
+1
I was looking for a fix for this issue and found one made by Nordsword3m on his fork of the project I haven't tested it yet
Just tested this one on Android and no, it doesn't work.
Here's a component which does most of the job for me - use state to capture whether recording is active or not. If recording is still active but recognition has stopped, start it again.
import React, { useCallback, useEffect, useState } from "react"
import { StyleProp, TextStyle, View, ViewStyle } from "react-native"
import { Text, Button } from "app/components"
import RNVoice from "@react-native-voice/voice"
export interface VoiceProps {
/**
* An optional style override useful for padding & margin.
*/
style?: StyleProp<ViewStyle>
isRecording?: boolean
setIsRecording?: (isRecording: boolean) => void
}
/**
* Describe your component here
*/
export const Voice = function Voice(props: VoiceProps) {
const { isRecording, setIsRecording } = props
const [transcript, setTranscript] = useState([])
const [partialTranscript, setPartialTranscript] = useState("")
useEffect(() => {
initVoice()
// startListening()
return () => {
RNVoice.destroy().then(RNVoice.removeAllListeners)
}
}, [])
useEffect(() => {
console.log({ isRecording })
if (isRecording) {
initVoice()
startListening()
} else {
stopListening()
}
}, [isRecording])
const initVoice = () => {
console.log("Init!")
RNVoice.onSpeechResults = onSpeechResults
RNVoice.onSpeechPartialResults = onSpeechPartialResults
RNVoice.onTranscriptionResults = (e) => {
console.log("TRANSCRIPTION", e)
}
RNVoice.onSpeechEnd = onSpeechEnd
RNVoice.onTranscriptionEnd = () => {
console.log("END")
}
}
const onSpeechEnd = async () => {
console.log("SPEECH END", isRecording)
if (isRecording) {
console.log("RESTARTING")
await stopListening()
await startListening()
}
}
const startListening = async () => {
try {
await RNVoice.start("en-AU")
} catch (e) {
console.error(e)
}
}
const stopListening = async () => {
try {
await RNVoice.stop()
} catch (e) {
console.error(e)
}
}
const onSpeechResults = (e) => {
const newTranscript = [...transcript, e.value[0]]
setTranscript(newTranscript)
console.log(newTranscript)
}
const onSpeechPartialResults = (e) => {
console.log("PARTIAL", e)
setPartialTranscript(e.value[0])
}
return (
<View>
<Text style={{ color: "white" }}>Partial: {partialTranscript}</Text>
<Text style={{ color: "white" }}>Transcript: {transcript}</Text>
<Text style={{ color: "white" }}>
Status: {isRecording ? "Recording" : "Waiting"}
</Text>
</View>
)
}