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

[Feature request] option to choose unprocessed microphone output of phone (and other processing options) #5670

Open
tekuseacc opened this issue Dec 15, 2024 · 2 comments

Comments

@tekuseacc
Copy link

tekuseacc commented Dec 15, 2024

I would like to have an option to remove the processing applied by the phone to it's microphone before being send via scrcpy.
by selecting a flag

for example

--mic-processing process 
          Select the mic process (default, unprocessed).
           this is applicable only if --audio-source is selected as "mic"
           Default is default.

Ideas from other open source projects which gives this option on android end
Recordingstudio app available on F-droid and github.

https://github.com/Leonidius20/RecordingStudio

image

Why is this feature useful

android devices usually apply some processing in the microphone to remove noise or to do automatic gain control
but since we can use pc with more processing power we can have more control to apply the processing the user wants using other applications in linux like easyeffects in real time or audacity after recording it will be useful if unprocessed microphone can be given to pc through scrcpy

I was amazed by the quality of taking unprocessed microphone input and processing it compared to mediocre processing on my phone which makes the mic quality muddy.

the above app "recording studio" can enables this features so I guess it would be possible by adb and scrcpy too .
scrcpy is awesome and I can use my low end phone as a microphone and use it wireless it would help to prevent buying
new expensive wireless microphones and Foss softwares like scrcpy is saving money and useful for environment by reducing the need to buy new hardware by enhancing already available options to next level.

thanks for this wonderful project

@tekuseacc tekuseacc changed the title option to choose unprocessed microphone output of phone (and other processing options) [Feature request] option to choose unprocessed microphone output of phone (and other processing options) Dec 15, 2024
@rom1v
Copy link
Collaborator

rom1v commented Dec 15, 2024

With this quick&dirty patch, do you get the expected behavior:

diff --git server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java
index 5c859738d..10af79f7f 100644
--- server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java
+++ server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java
@@ -40,7 +40,7 @@ public class AudioDirectCapture implements AudioCapture {
             case OUTPUT:
                 return MediaRecorder.AudioSource.REMOTE_SUBMIX;
             case MIC:
-                return MediaRecorder.AudioSource.MIC;
+                return MediaRecorder.AudioSource.UNPROCESSED;
             default:
                 throw new IllegalArgumentException("Unsupported audio source: " + audioSource);
         }

?

If so, are you interested in implementing it and submitting a PR with a new option?

I don't know if it should added as a new option or a new --audio-source completely? (I have a preference for --mic-processing=…)

Refs https://developer.android.com/reference/android/media/MediaRecorder.AudioSource

@tekuseacc
Copy link
Author

With this quick&dirty patch, do you get the expected behavior:

diff --git server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java
index 5c859738d..10af79f7f 100644
--- server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java
+++ server/src/main/java/com/genymobile/scrcpy/audio/AudioDirectCapture.java
@@ -40,7 +40,7 @@ public class AudioDirectCapture implements AudioCapture {
             case OUTPUT:
                 return MediaRecorder.AudioSource.REMOTE_SUBMIX;
             case MIC:
-                return MediaRecorder.AudioSource.MIC;
+                return MediaRecorder.AudioSource.UNPROCESSED;
             default:
                 throw new IllegalArgumentException("Unsupported audio source: " + audioSource);
         }

?

I would love to test this but unfortunately I am not a developer and just a simple end user but based on the reference material you shared I feel this patch would work but yeah I don't know how to test it yet

If so, are you interested in implementing it and submitting a PR with a new option?

I am afraid I don't have the technical knowledge to do it yet I am trying to learn newbie guides on how to fork and edit but I would be grateful if someone with developing expertise can do it

I don't know if it should added as a new option or a new --audio-source completely? (I have a preference for --mic-processing=…)

either of them would work for me as I am more focused on UNPROCESSED option only but if in future someone else want additional options like [VOICE_COMMUNICATION, VOICE_RECOGNITION) (--mic-processing=…) would be good I guess

Refs https://developer.android.com/reference/android/media/MediaRecorder.AudioSource

This reference was useful thanks and I was just reading about it and gained a little knowledge. thank you for your prompt response

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