Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth recognition crash #471

Open
Montso-Matlaletsa opened this issue Dec 12, 2023 · 0 comments
Open

Bluetooth recognition crash #471

Montso-Matlaletsa opened this issue Dec 12, 2023 · 0 comments

Comments

@Montso-Matlaletsa
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch @react-native-voice/voice@3.2.4 for the project I'm working on.

The main issue was that whenever bluetooth headphones was connected, The app would crash without recognising any text.

Here is the diff that solved my problem:

diff --git a/node_modules/@react-native-voice/voice/ios/Voice/Voice.m b/node_modules/@react-native-voice/voice/ios/Voice/Voice.m
index fd9dad8..3f18776 100644
--- a/node_modules/@react-native-voice/voice/ios/Voice/Voice.m
+++ b/node_modules/@react-native-voice/voice/ios/Voice/Voice.m
@@ -224,6 +224,8 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
     @try {
         [mixer installTapOnBus:0 bufferSize:1024 format:recordingFormat block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {
             //Volume Level Metering
+            //Buffer frame can be reduced, if you need more output values
+            [buffer setFrameLength:buffer.frameCapacity];
             UInt32 inNumberFrames = buffer.frameLength;
             float LEVEL_LOWPASS_TRIG = 0.5;
             if(buffer.format.channelCount>0)

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant