voice icon indicating copy to clipboard operation
voice copied to clipboard

required condition is false: format.sampleRate == hwFormat.sampleRate, regression of #50

Open lukemcgregor opened this issue 6 years ago • 4 comments
trafficstars

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

  1. react-native init test
  2. cd test
  3. yarn add [email protected]
  4. react-native link react-native-voice
  5. add code sample below
  6. run in xcode (so you get output)
  7. 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 avatar Aug 14 '19 03:08 lukemcgregor

@lukemcgregor Did you solved your problem?

lfoliveir4 avatar Dec 16 '19 12:12 lfoliveir4

Any solution ?

youstronsic avatar Dec 18 '19 14:12 youstronsic

+1

tradebulls avatar Sep 06 '21 06:09 tradebulls

+1

lnqminh3003 avatar Mar 19 '24 15:03 lnqminh3003