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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS recognition only works if speak loudly/closely to mic #32

Open
bobosette opened this issue Mar 1, 2022 · 13 comments
Open

iOS recognition only works if speak loudly/closely to mic #32

bobosette opened this issue Mar 1, 2022 · 13 comments

Comments

@bobosette
Copy link

Hi @Caldarie . My app is in test mode right now. Someone reported that on iOS the recognition works only if people speak loud close to the microphone. Did you ever report an issue like that??

Thank you

@Caldarie
Copy link
Owner

Caldarie commented Mar 1, 2022

Hi @bobosette

It seems iOS has been giving alot of issues lately 😆

For the earlier tflite_audio versions, this has been an issue. The reason being that the arrays have not been splicing properly. The later versions should of solved this problem but there could be a possibility that i have missed something.

Currently, i have been refractoring my code so that i could implement unit tests to find such issues. You can find my latest work on this branch here. Once i am done, i should be able to do an extensive test to find such bugs

@Caldarie Caldarie changed the title Audio problem iOS recognition only works if speak loudly/closely to mic Mar 1, 2022
@bobosette
Copy link
Author

Ok...maybe i will try that branch

@Caldarie
Copy link
Owner

Caldarie commented Mar 8, 2022

hi @bobosette

Can you provide your recording parameters for me?

I have finally refractored my code and can run unit tests yo check whether theres any problem with the splicing.

@bobosette
Copy link
Author

Hi @Caldarie . This is my recording parameters:

`
//model initialization
TfliteAudio.loadModel(
inputType: 'rawAudio',
numThreads: 1,
outputRawScores: true,
isAsset: true,
model:
'assets/cough_model.tflite',
label:
'assets/cough_label.txt'
);

// bring to foreground
FlutterBackgroundService().setForegroundMode(true);

Stream<Map<dynamic, dynamic>>? result;

result = TfliteAudio.startAudioRecognition(
sampleRate: 44100,
//recordingLength: 44032,
bufferSize: 11008, // to get 2-3 secs of analisys instead of 1
numOfInferences: 99999,
detectionThreshold: 0.7,
averageWindowDuration: 1500,
);
`

@bobosette
Copy link
Author

Hi @c. Do u have some news??

@Caldarie
Copy link
Owner

Hi

I have ran the tests as found here.

Good news is that all tests have passed and there should be no problems with the recording. I will post an update once i have finished refactoring android code.

@bobosette
Copy link
Author

bobosette commented Mar 14, 2022 via email

@Caldarie
Copy link
Owner

Caldarie commented Mar 18, 2022

hi @bobosette

I have updated the package to 0.3.0. There are alot of bug fixes for both android and iOS. Let me know if you encounter any bugs

I also added asynchronous tasks for iOS, so you may want to try the background_task plugin again to see if it works.

As for the recognition issue which you mentioned, I do have an idea why this issue occurs. It seems that when the plugin splices the recording, it may splice the intended voice in half and hence becomes unrecognisable when fed into the model. To address this issue, I will introduce an overlapping feature for the next update.

@bobosette
Copy link
Author

bobosette commented Mar 18, 2022 via email

@bobosette
Copy link
Author

Hi @Caldarie. I was going to try your update, but when I run the Debug I have this error:

Error: CocoaPods's specs repository is too out-of-date to satisfy dependencies.
To update the CocoaPods specs, run:
pod repo update

Exception: Error running pod install

Then i do pod repo update, but same error.

@bobosette
Copy link
Author

I forgot to tell you this: now with the latest update of flutter_background_service I was able to run flutter_tflite_audio also on background.

@Caldarie
Copy link
Owner

@bobosette

I have updated the plugin to work with the latest iOS packages, hence why you recieved the error.

To fix this issue:

flutter clean
delete /ios/Pods
delete /ios/Podfile.lock
flutter pub get
from inside ios folder: pod install Run

@bobosette
Copy link
Author

Ok perfect thank you

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

2 participants