Voice: Is it possible to disable speech recognition ending automatically?

Created on 3 Jul 2018  路  16Comments  路  Source: react-native-voice/voice

I would like to use the module for longer phrases and perhaps even paragraphs, but the module automatically stops when there is a short pause detected. Any way to disable this and only stop recognition when the user presses a button?

help wanted feature request

All 16 comments

@ZhiSh3n I also want the same kind of stuff.

@devblucursor I believe it is possible by setting the EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS constant, which you can read about here. However, my experiments seem to indicate that setting this constant will not have any effect on API < 8.

@ZhiSh3n Thanks! Man :)

I have been looking for a solution for this issue as well, but so far without any luck... It seems that this issue is not related to this module, but the issue lies with android itself. Not sure if there is any fix out there. Have thought about creating a method which would automatically trigger recording again if android stops it, but haven't been successful with that one yet either.

I really need it too =(

we can expose this option on javascript side

we gonna accept a PR that solves this

are there any news on this feature?

nu?

any update??

@zhish3n Did your solved your problem?

would love to see any solutions anyone has found

+1

I chose to check it every half second and just refresh if it has ended:

async checkRecognition() {
  await Voice.isRecognizing().then(result => {
    if (result != 1) {
      Voice.start('en-US')
    } else {
      return true
    }
  })
}

would love to see any solutions anyone has found

try my logic ...

  • create looping after speech end

onSpeechEnd = (e) => {
this._startRecognizing();
};

  • handle stop with add var for condition

onSpeechEnd = (e) => {
if (this.state.end == false) {
this._startRecognizing();
}
};

_startRecognizing = () => {
this.setState({
end: false,
});
Voice.start("in-ID");
};

_stopRecognizing = () => {
Voice.stop();
this.setState({
end: true,
});
};

would love to see any solutions anyone has found

try my logic ...

  • create looping after speech end

onSpeechEnd = (e) => {
this._startRecognizing();
};

  • handle stop with add var for condition

onSpeechEnd = (e) => {
if (this.state.end == false) {
this._startRecognizing();
}
};

_startRecognizing = () => {
this.setState({
end: false,
});
Voice.start("in-ID");
};

_stopRecognizing = () => {
Voice.stop();
this.setState({
end: true,
});
};

  • for handle the result, create temp

onSpeechPartialResults = (e) => {
this.setState({ partialResults: e.value });
};

onSpeechEnd = (e) => {
if (this.state.partialResults == "") {
this.setState({
status: "End",
});
} else {
this.setState({
status: "End",
partialResults: "",
temp: this.state.temp + " " + this.state.partialResults,
});
}
if (this.state.end == false) {
this._startRecognizing();
}
};

  • get the total result in state.temp

good luck ;)

any legit way to stop voice recognition to NOT stop by itself?
looping it could be an option but it's not a legit solution.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikodunk picture nikodunk  路  3Comments

Louis-7 picture Louis-7  路  7Comments

B4ckes picture B4ckes  路  5Comments

alvaro1728 picture alvaro1728  路  5Comments

alvaro1728 picture alvaro1728  路  3Comments