Myzel394 / Alibi

Use your phone as a dashcam and save the last 30 minutes when you need them.
GNU General Public License v3.0
232 stars 11 forks source link

Option to switch to microphone from wireless earphone. #22

Closed AllenCyborg closed 10 months ago

AllenCyborg commented 10 months ago

I couldn't find any option to switch the microphone/audio source from the inbuilt microphone on my phone to the one in my wireless earphone.

Device: Realme Narzo 30A OS: Android 11(realme ui) Earphone used: Truke BTG Beta

This would be a really great feature as it would provide clearer audio when for example the phone is in a pocket and is walking? Or when only the earphones are connected and the phone is in a bag or something.

Can you consider adding this as a feature?

Myzel394 commented 10 months ago

Good idea! I created a PR which should add this feature, do you want to try it out @AllenCyborg, I'm not sure if it'll work on a Realme device ?

AllenCyborg commented 10 months ago

I'd love to~

Myzel394 commented 10 months ago

Nice! You can find a debug build here by downloading the "artifact", extracting it and then installing the app-universal.apk file. It's a bit buggy still, but you can try it out already :D If you encounter some issues or need help installing it, feel free to reach out to me :)

AllenCyborg commented 10 months ago

Inside the artifact.zip file I found a file called app-universal-debug.apk and installed it. It launched with no problem, but crashes when I press record.

The first time it crashed after I gave it microphone permission. The second time onwards, it crashed as soon as I pressed record button.

AllenCyborg commented 10 months ago

Accidentally closed the thread earlier... Sorry about that

Myzel394 commented 10 months ago

damn it, can you try running it with and without your external mic connected? (I think it was Bluetooth, wasn't it? In this case, try running it with and without your headphones connected). "Unfortunately" it's working on my side :/

Myzel394 commented 10 months ago

Ahh I'm able to reproduce it on an emulator. Gonna take a look at it now!

AllenCyborg commented 10 months ago

damn it, can you try running it with and without your external mic connected? (I think it was Bluetooth, wasn't it? In this case, try running it with and without your headphones connected). "Unfortunately" it's working on my side :/

I did, and even with no external mics the app crashed. Just to be sure, I even uninstalled the version I had installed from fdroid, but it still crashed.

AllenCyborg commented 10 months ago

Ahh I'm able to reproduce it on an emulator. Gonna take a look at it now!

you mean the crash?

Myzel394 commented 10 months ago

Yes, you can find a new debug build here https://github.com/Myzel394/Alibi/actions/runs/6600080243, this should hopefully work ^^

AllenCyborg commented 10 months ago

This one doesn't crash, but not picking up audio from my bt earphone...

Myzel394 commented 10 months ago

@AllenCyborg did you change the microphone to it? You may also need to speak a bit louder into it, I also had problems at first but turns out my microphone was just not picking up normal conversation loudness :D

AllenCyborg commented 10 months ago

I did change from the settings. I'll try louder.

AllenCyborg commented 10 months ago

Tried. As far as I can tell, it isn't picking up the tws microphone. Also, I connected a wired earphone which was detected as a hidden microphone but, manually choosing other microphone s such as device microphone, back, or bottom didn't change the source. As long as the wired earphone was plugged in, it was the audio source...

AllenCyborg commented 10 months ago

Could it be an Android 11 limitation?

Myzel394 commented 10 months ago

Tried. As far as I can tell, it isn't picking up the tws microphone

Is there like no sound or is the sound being picked up by your phone instead?

manually choosing other microphone s such as device microphone, back, or bottom didn't change the source

Yeah I also noticed this behavior, I think Android doesn't allow specifying the exact microphone and it will instead use the default one

As long as the wired earphone was plugged in, it was the audio source...

At least something ^^

AllenCyborg commented 10 months ago

Is there like no sound or is the sound being picked up by your phone instead?

Sound is picked up by the phone or the wired earphone if it's connected

AllenCyborg commented 10 months ago

Yeah I also noticed this behavior, I think Android doesn't allow specifying the exact microphone and it will instead use the default one

Seems so. I was looking for a recorder that had this functionality and couldn't find any. Seems like calls and Google assistant use tws mic tho...🤔

Myzel394 commented 10 months ago

Seems like calls and Google assistant use tws mic tho

I think those are system apps, they have more permissions than normal apps

Myzel394 commented 10 months ago

I tested it on another device running Android 9, @AllenCyborg can you try it again with the newest build? :D

AllenCyborg commented 10 months ago

Works!!! This is just awesome. Thanks for adding this @Myzel394

Myzel394 commented 10 months ago

Nice! One last question: Was your microphone shown as a hidden microphone or normally?

AllenCyborg commented 10 months ago

Normal I suppose... I didn't have to toggle on hidden microphones option.

AllenCyborg commented 10 months ago

Noticed the quality of music playing through the earphones drop when alibi is using the mics. Sounds hollow. The quality is restored if I tap the earphone's touch sensor but then the app sources audio from the phone's mic even though the tws is selected as the source.

Did you also notice this?

Could be that my particular pair is behaving odd...(other odd things also happen with telegram and WhatsApp calls, so I wouldn't be surprised...)

I've tried different modes of the earphones as well as switching between AAC and SBC codecs and the above problem (of loss of quality/changing mics when tapped) is consistent.

Myzel394 commented 10 months ago

Noticed the quality of music playing through the earphones drop when alibi is using the mics

Also noticed a worse quality when using an external mic. However, I think it's because my microphone is bad.

The quality is restored if I tap the earphone's touch sensor

What does this do? Does it change like the source or something?

Could be that my particular pair is behaving odd...(other odd things also happen with telegram and WhatsApp calls, so I wouldn't be surprised...)

I guess then you're mic also isn't that good :P

I've tried different modes of the earphones as well as switching between AAC and SBC codecs and the above problem (of loss of quality/changing mics when tapped) is consistent.

Then I'm probably not able to do something about it :/