Speaker output to mic input without cable on Android?

馋奶兔 提交于 2019-12-12 10:24:08

问题


I want to connect speaker output to mic input on Android phone without using any physical cable. Such routing should be transparent to all apps. With this function I can design a bunch of interesting apps, e.g., measuring round-trip delay of a voip call, automatically replying to an incoming call etc.

Some similar questions can be found here:

Background music for call

Outputting audio stream into microphone

It seems that there is no solution on Android right now, but the tool JACK running on Linux is the closet one. Can someone provide me some scripts or codes to create a JACK client that realizes this (speaker -> mic) on Linux? And how hard would it be to port JACK server and client to Android?

Thanks!


回答1:


Getting Jack on Linux to connect the mic to the speakers:

  1. Start Jack with QJackCtl. This is not as easy as it sounds:
    1. Start QJackCtl.
    2. Click the "Setup..." button.
    3. Choose "alsa" from the "Driver:" dropdown.
    4. Choose your soundcard/soundcards that you want to work with from the "Input Device" and "Output Device" dropdowns. Note that if you have a relatively capable soundcard, there may be a number of possible devices for it (my Audigy 2 ZS has four). Choosing the correct one is beyond the scope of this tutorial.
    5. Check the latency in the bottom-right corner. Realize that Jack itself will take some time to process the sound. This gives you information about that (and I'm sorry, but I don't know precisely what it means). Running Jack is often a tradeoff between getting a super low latency and avoiding "xruns", which are where Jack has to give up on processing a section of audio. Xruns often result in a "click" sound.
    6. Click "OK."
  2. Click the "Connect" button.
  3. This opens the "Connections" panel. This is basically a place that you can plug different Jack applications into one another so they process audio from each other.
  4. Choose the input ("system" on the left) and the output ("system" on the right) and click "Connect". You may need to look through the various things listed under "system" on one or both sides to find the thing that's actually capturing from your mic/outputting to your speakers, in which case . Again, this is beyond the scope of this tutorial; Google is your friend, as is trial and error.
  5. Enjoy the noise of feedback when you bring the microphone near the speakers.

As far as porting Jack to Android goes, you might take a look at this, which basically seems to indicate that Android isn't able to handle the low-latency requirements of Jack (which might also cause you problems in trying to do latency measurements). You could also look at this and this, which might offer an alternative way to do what you're trying to do (I'm not sure where it stands regarding the latency issues, also, I've never used either PD or libpd myself).



来源:https://stackoverflow.com/questions/18384120/speaker-output-to-mic-input-without-cable-on-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!