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

Storing recording stream data in a file and noise issue #950

Closed
ashfaq1701 opened this issue Jul 16, 2020 · 3 comments
Closed

Storing recording stream data in a file and noise issue #950

ashfaq1701 opened this issue Jul 16, 2020 · 3 comments

Comments

@ashfaq1701
Copy link
Contributor

ashfaq1701 commented Jul 16, 2020

I am trying to build a mixer using oboe. I am still working in the recording screen.

https://github.com/ashfaq1701/fast-mixer

I have a feature where user can choose to hear what he is recording in microphone speaker live. This is to give some studio like feeling. I had two options (in fact I implemented both). One is to write the recorded data in an array buffer,

https://github.com/ashfaq1701/fast-mixer/blob/feature/buffer-based-recording/app/src/main/cpp/SoundRecording.cpp

Another is to keep writing raw data in a file,

https://github.com/ashfaq1701/fast-mixer/blob/master/app/src/main/cpp/SoundRecording.cpp

I don't want the user to get limited in the RAM space while recording. So I prefer the file write approach. To make the process less expensive, I am opening both reading and writing file pointers when the user opens the stream and closing them when they pause / stop. In each callback I am just writing data using fwrite. Also I am doing file IO in an async function call.

https://github.com/ashfaq1701/fast-mixer/blob/master/app/src/main/cpp/AudioEngine.cpp#L61

I am not having any significant latency. Is this a proper approach? Or I am going in a wrong direction?

Also while recording I am getting a lot of noise (I am using a Xiaomi Mi 9t Pro device for testing). I am setting my recording stream here,

https://github.com/ashfaq1701/fast-mixer/blob/master/app/src/main/cpp/AudioEngine.cpp#L206

I am using,

int32_t mRecordingDeviceId = oboe::VoiceRecognition;

As recording device.

What can I do to reduce the noise? Are there any built-in way to suppress noise? Or I need to write custom algorithm for this?

Please help me regarding these issues if possible.

@rpattabi
Copy link
Contributor

rpattabi commented Jul 17, 2020

I don't know if this is related. But take a look at #911. This is something to consider when using VoiceRecognition input preset as some Xiaomi devices (Note 4) do not follow expected standards.

Also as per Android CDD, noise suppression is supposed to be disabled for VoiceRecognition preset.

@ashfaq1701
Copy link
Contributor Author

Thank you @rpattabi ! Can you kindly tell me which preset suppress noise by default?

@rpattabi
Copy link
Contributor

I don't think there is such a preset. But you might want to take a look at https://source.android.com/compatibility/10/android-10-cdd#5_multimedia_compatibility

There is Noise Suppressor api which you can use. But I was not able to make it work with oboe. Take a look at this tech note from oboe team on audio effects.

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