voice
voice copied to clipboard
required condition is false: format.sampleRate == hwFormat.sampleRate, regression of #50
Bug
When I start recognising I get an exception:
Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate'
This appears to be the same thing as #50 but I am using a new version (0.3.0) which apparently has the fix in it? Certainly 0.3.0 matches the Voice.m code in master which was the suggested fix to this issue in #50
Environment info
React native info output:
System:
OS: macOS 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 4.47 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.7.0 - ~/.nvm/versions/node/v12.7.0/bin/node
Yarn: 1.17.3 - ~/.nvm/versions/node/v12.7.0/bin/yarn
npm: 6.10.2 - ~/.nvm/versions/node/v12.7.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
IDEs:
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
npmGlobalPackages:
react-native-cli: 2.0.1
Library version: 0.3.0
Steps To Reproduce
react-native init testcd testyarn add [email protected]react-native link react-native-voice- add code sample below
- run in xcode (so you get output)
- click start -> Error
Describe what you expected to happen:
It shouldn't throw
Reproducible sample code
import Voice from "react-native-voice";
import React, { Component } from "react";
import { Text, Button, View } from "react-native";
class VoiceTest extends Component {
constructor(props) {
super(props);
this.state = {
text: "Speak first",
running: false,
};;
Voice.onSpeechResults = this.onSpeechResultsHandler.bind(this);
this.toggle = this.toggle.bind(this);
}
toggle() {
if (this.state.running) {
this.setState({ running: false });
Voice.stop();
} else {
this.setState({ running: true });
Voice.start("en-US");
}
}
onSpeechResultsHandler(result) {
console.log('speech result: ', result);;
}
render() {
const { text, running } = this.state;
return (
<View>
<Text>{text}</Text>
<Button onPress={this.toggle} title={running ? "Stop" : "Start"} />
</View>
);
}
}
export default VoiceTest;
@lukemcgregor Did you solved your problem?
Any solution ?
+1
+1