audio-share icon indicating copy to clipboard operation
audio-share copied to clipboard

[New Feature] Add wired (USB) support for Android devices

Open scorpiofifth opened this issue 7 months ago • 4 comments

Describe the new feature you'd like I propose adding a method to share audio from an Android phone to the computer, effectively using the phone as a microphone, through a USB connection with the Android Debug Bridge (ADB).

Describe the reason why you want to add the feature This feature would provide a superior user experience compared to a wireless connection, offering lower latency and higher audio quality. Additionally, a wired USB connection allows the phone to be charged by the computer simultaneously.

Describe how to implement the feature if you can As I am not a developer, I cannot provide a specific implementation plan. However, a similar feature exists in a software called "WO Mic," which uses the Android Debug Bridge to turn a phone into a microphone. This might serve as a helpful reference.

scorpiofifth avatar Jul 14 '25 13:07 scorpiofifth

You can forward a port over ADB to achieve this.

adb reverse tcp:65530 tcp:65530

Then, set the IP on the phone to 127.0.0.1.

1upbyte avatar Jul 31 '25 21:07 1upbyte

You can forward a port over ADB to achieve this.

adb reverse tcp:65530 tcp:65530

Then, set the IP on the phone to 127.0.0.1.

@1upbyte Thank you for your suggestion.

Unfortunately, this solution didn't work for me. The client application shows the following error:

Not enough data available, required 4 bytes but only 0 available.

After some research, it seems the issue is that adb reverse only forwards TCP connections, not UDP. However, it appears this application requires both TCP and UDP protocols to function correctly.

scorpiofifth avatar Aug 01 '25 04:08 scorpiofifth

Weird. I have it working. I got the same error as you when I didn't start the server on the PC. Also try with --bind=127.0.0.1 on the server.

1upbyte avatar Aug 01 '25 06:08 1upbyte

@1upbyte Thanks a lot, your suggestion worked to get the client connected!

Now, however, there's no audio output on the phone, even though the connection is active.

Here are the two corresponding log files:

Log 1: Running with as-cmd -V --bind=127.0.0.1 (connected, no audio)

[2025-08-01 18:06:42.559] [info] pipewire header_version: 0.3.48, library_version: 1.4.7
[2025-08-01 18:06:42.565] [info] tcp listen success on 127.0.0.1:65530
[2025-08-01 18:06:42.565] [trace] sync before: 0
[2025-08-01 18:06:42.565] [trace] sync after: 1073741827
[2025-08-01 18:06:42.565] [info] udp listen success on 127.0.0.1:65530
[2025-08-01 18:06:42.565] [info] server started
[2025-08-01 18:06:42.567] [trace] sync before: 1073741827
[2025-08-01 18:06:42.567] [trace] sync after: 1073741830
[2025-08-01 18:06:42.567] [trace] object id: 31
[2025-08-01 18:06:42.567] [trace] 	object.serial: "31"
[2025-08-01 18:06:42.567] [trace] 	factory.id: "19"
[2025-08-01 18:06:42.567] [trace] 	priority.session: "1009"
[2025-08-01 18:06:42.567] [trace] 	priority.driver: "1009"
[2025-08-01 18:06:42.567] [trace] 	node.name: "Audio Share Sink"
[2025-08-01 18:06:42.567] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:06:42.568] [trace] object id: 68
[2025-08-01 18:06:42.568] [trace] 	object.serial: "2503"
[2025-08-01 18:06:42.568] [trace] 	object.path: "alsa:acp:hdaudioB0D2:0:playback"
[2025-08-01 18:06:42.568] [trace] 	factory.id: "19"
[2025-08-01 18:06:42.568] [trace] 	client.id: "46"
[2025-08-01 18:06:42.568] [trace] 	device.id: "47"
[2025-08-01 18:06:42.568] [trace] 	priority.session: "696"
[2025-08-01 18:06:42.568] [trace] 	priority.driver: "696"
[2025-08-01 18:06:42.568] [trace] 	node.description: "Built-in Audio HDMI / DisplayPort 3 Output"
[2025-08-01 18:06:42.568] [trace] 	node.name: "alsa_output.platform-avs_hdaudio.2.HiFi__HDMI3__sink"
[2025-08-01 18:06:42.568] [trace] 	node.nick: "HDMI / DisplayPort 3 Output"
[2025-08-01 18:06:42.568] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:06:42.568] [trace] object id: 59
[2025-08-01 18:06:42.568] [trace] 	object.serial: "2504"
[2025-08-01 18:06:42.568] [trace] 	object.path: "alsa:acp:hdaudioB0D2:1:playback"
[2025-08-01 18:06:42.568] [trace] 	factory.id: "19"
[2025-08-01 18:06:42.568] [trace] 	client.id: "46"
[2025-08-01 18:06:42.568] [trace] 	device.id: "47"
[2025-08-01 18:06:42.568] [trace] 	priority.session: "712"
[2025-08-01 18:06:42.568] [trace] 	priority.driver: "712"
[2025-08-01 18:06:42.568] [trace] 	node.description: "Built-in Audio HDMI / DisplayPort 2 Output"
[2025-08-01 18:06:42.568] [trace] 	node.name: "alsa_output.platform-avs_hdaudio.2.HiFi__HDMI2__sink"
[2025-08-01 18:06:42.568] [trace] 	node.nick: "HDMI / DisplayPort 2 Output"
[2025-08-01 18:06:42.568] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:06:42.568] [trace] object id: 60
[2025-08-01 18:06:42.568] [trace] 	object.serial: "2505"
[2025-08-01 18:06:42.568] [trace] 	object.path: "alsa:acp:hdaudioB0D2:2:playback"
[2025-08-01 18:06:42.568] [trace] 	factory.id: "19"
[2025-08-01 18:06:42.568] [trace] 	client.id: "46"
[2025-08-01 18:06:42.568] [trace] 	device.id: "47"
[2025-08-01 18:06:42.568] [trace] 	priority.session: "728"
[2025-08-01 18:06:42.568] [trace] 	priority.driver: "728"
[2025-08-01 18:06:42.568] [trace] 	node.description: "Built-in Audio HDMI / DisplayPort 1 Output"
[2025-08-01 18:06:42.568] [trace] 	node.name: "alsa_output.platform-avs_hdaudio.2.HiFi__HDMI1__sink"
[2025-08-01 18:06:42.568] [trace] 	node.nick: "HDMI / DisplayPort 1 Output"
[2025-08-01 18:06:42.568] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:06:42.568] [info] select audio endpoint: 31, Audio Share Sink
[2025-08-01 18:06:42.596] [trace] stream node id: 112
[2025-08-01 18:06:42.596] [trace] stream properties:
[2025-08-01 18:06:42.596] [trace] 	media.type = "Audio"
[2025-08-01 18:06:42.596] [trace] 	media.category = "Capture"
[2025-08-01 18:06:42.596] [trace] 	media.role = "Music"
[2025-08-01 18:06:42.596] [trace] 	application.name = "Audio Share Server"
[2025-08-01 18:06:42.596] [trace] 	node.name = "Audio Share Server"
[2025-08-01 18:06:42.596] [trace] 	target.object = "31"
[2025-08-01 18:06:42.596] [trace] 	media.name = "audio-share-server"
[2025-08-01 18:06:42.596] [trace] 	stream.is-live = "true"
[2025-08-01 18:06:42.596] [trace] 	node.want-driver = "true"
[2025-08-01 18:06:42.596] [trace] 	node.autoconnect = "true"
[2025-08-01 18:06:42.596] [trace] 	media.class = "Stream/Input/Audio"
[2025-08-01 18:06:42.596] [trace] 	object.serial = "5245"
[2025-08-01 18:06:42.596] [trace] 	factory.id = "9"
[2025-08-01 18:06:42.596] [trace] 	client.id = "109"
[2025-08-01 18:06:42.596] [info] stream name: audio-share-server
[2025-08-01 18:06:42.596] [info] audio_info.info.raw.format: 283
[2025-08-01 18:06:42.596] [info] the capture format is supported
[2025-08-01 18:06:42.596] [info] block_align: 8
[2025-08-01 18:06:42.597] [info] AudioFormat:
encoding: ENCODING_PCM_FLOAT
channels: 2
sample_rate: 48000

[2025-08-01 18:06:42.598] [trace] now:31412337362510 rate:1/48000 ticks:0 delay:0 queued:0
[2025-08-01 18:06:43.598] [trace] now:31427524612579 rate:1/48000 ticks:48128 delay:0 queued:0
[2025-08-01 18:06:44.388] [info] accept 127.0.0.1:48341
[2025-08-01 18:06:44.393] [trace] cmd 1
[2025-08-01 18:06:44.486] [trace] cmd 2
[2025-08-01 18:06:44.486] [trace] add_playing_peer add id:1 tcp://127.0.0.1:48341
[2025-08-01 18:06:44.598] [trace] now:31428527279230 rate:1/48000 ticks:96256 delay:0 queued:0
[2025-08-01 18:06:45.598] [trace] now:31429529945881 rate:1/48000 ticks:144384 delay:0 queued:0
[2025-08-01 18:06:46.598] [trace] now:31430532612532 rate:1/48000 ticks:192512 delay:0 queued:0
[2025-08-01 18:06:47.494] [trace] cmd 3
[2025-08-01 18:06:47.598] [trace] now:31431535279183 rate:1/48000 ticks:240640 delay:0 queued:0
[2025-08-01 18:06:48.598] [trace] now:31432516612501 rate:1/48000 ticks:287744 delay:0 queued:0
[2025-08-01 18:06:49.598] [trace] now:31433540612485 rate:1/48000 ticks:336896 delay:0 queued:0
[2025-08-01 18:06:50.493] [trace] cmd 3
[2025-08-01 18:06:50.598] [trace] now:31434521945803 rate:1/48000 ticks:384000 delay:0 queued:0
[2025-08-01 18:06:51.598] [trace] now:31435503279121 rate:1/48000 ticks:431104 delay:0 queued:0
[2025-08-01 18:06:52.598] [trace] now:31436527279105 rate:1/48000 ticks:480256 delay:0 queued:0
[2025-08-01 18:06:53.494] [trace] cmd 3
[2025-08-01 18:06:53.598] [trace] now:31437508612423 rate:1/48000 ticks:527360 delay:0 queued:0
[2025-08-01 18:06:54.598] [trace] now:31438532612407 rate:1/48000 ticks:576512 delay:0 queued:0
[2025-08-01 18:06:55.598] [trace] now:31439513945725 rate:1/48000 ticks:623616 delay:0 queued:0
[2025-08-01 18:06:56.496] [trace] cmd 3
[2025-08-01 18:06:56.598] [trace] now:31440537945709 rate:1/48000 ticks:672768 delay:0 queued:0
[2025-08-01 18:06:57.598] [trace] now:31441519279027 rate:1/48000 ticks:719872 delay:0 queued:0
[2025-08-01 18:06:58.598] [trace] now:31442500612345 rate:1/48000 ticks:766976 delay:0 queued:0
[2025-08-01 18:06:59.494] [trace] cmd 3
[2025-08-01 18:06:59.598] [trace] now:31443524612329 rate:1/48000 ticks:816128 delay:0 queued:0
[2025-08-01 18:07:00.598] [trace] now:31444505945647 rate:1/48000 ticks:863232 delay:0 queued:0
[2025-08-01 18:07:01.598] [trace] now:31445529945631 rate:1/48000 ticks:912384 delay:0 queued:0
[2025-08-01 18:07:02.494] [trace] cmd 3
[2025-08-01 18:07:02.598] [trace] now:31446532612282 rate:1/48000 ticks:960512 delay:0 queued:0
[2025-08-01 18:07:03.598] [trace] now:31447535278933 rate:1/48000 ticks:1008640 delay:0 queued:0
[2025-08-01 18:07:03.681] [info] close 127.0.0.1:48341
[2025-08-01 18:07:03.681] [trace] remove_playing_peer remove tcp://127.0.0.1:48341
[2025-08-01 18:07:03.681] [trace] read_loop End of file
[2025-08-01 18:07:03.681] [trace] stop read_loop
[2025-08-01 18:07:04.598] [trace] now:31448537945584 rate:1/48000 ticks:1056768 delay:0 queued:0

Log 2: Running with as-cmd -V -b (connected with the computer ip, audio works)

[2025-08-01 18:05:08.838] [info] pipewire header_version: 0.3.48, library_version: 1.4.7
[2025-08-01 18:05:08.846] [info] tcp listen success on 192.168.100.206:65530
[2025-08-01 18:05:08.847] [trace] sync before: 0
[2025-08-01 18:05:08.847] [trace] sync after: 1073741827
[2025-08-01 18:05:08.847] [info] udp listen success on 192.168.100.206:65530
[2025-08-01 18:05:08.847] [info] server started
[2025-08-01 18:05:08.849] [trace] sync before: 1073741827
[2025-08-01 18:05:08.849] [trace] sync after: 1073741830
[2025-08-01 18:05:08.850] [trace] object id: 31
[2025-08-01 18:05:08.850] [trace] 	object.serial: "31"
[2025-08-01 18:05:08.850] [trace] 	factory.id: "19"
[2025-08-01 18:05:08.850] [trace] 	priority.session: "1009"
[2025-08-01 18:05:08.850] [trace] 	priority.driver: "1009"
[2025-08-01 18:05:08.850] [trace] 	node.name: "Audio Share Sink"
[2025-08-01 18:05:08.850] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:05:08.850] [trace] object id: 68
[2025-08-01 18:05:08.850] [trace] 	object.serial: "2503"
[2025-08-01 18:05:08.850] [trace] 	object.path: "alsa:acp:hdaudioB0D2:0:playback"
[2025-08-01 18:05:08.850] [trace] 	factory.id: "19"
[2025-08-01 18:05:08.850] [trace] 	client.id: "46"
[2025-08-01 18:05:08.850] [trace] 	device.id: "47"
[2025-08-01 18:05:08.850] [trace] 	priority.session: "696"
[2025-08-01 18:05:08.850] [trace] 	priority.driver: "696"
[2025-08-01 18:05:08.850] [trace] 	node.description: "Built-in Audio HDMI / DisplayPort 3 Output"
[2025-08-01 18:05:08.851] [trace] 	node.name: "alsa_output.platform-avs_hdaudio.2.HiFi__HDMI3__sink"
[2025-08-01 18:05:08.851] [trace] 	node.nick: "HDMI / DisplayPort 3 Output"
[2025-08-01 18:05:08.851] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:05:08.851] [trace] object id: 59
[2025-08-01 18:05:08.851] [trace] 	object.serial: "2504"
[2025-08-01 18:05:08.851] [trace] 	object.path: "alsa:acp:hdaudioB0D2:1:playback"
[2025-08-01 18:05:08.851] [trace] 	factory.id: "19"
[2025-08-01 18:05:08.851] [trace] 	client.id: "46"
[2025-08-01 18:05:08.851] [trace] 	device.id: "47"
[2025-08-01 18:05:08.851] [trace] 	priority.session: "712"
[2025-08-01 18:05:08.851] [trace] 	priority.driver: "712"
[2025-08-01 18:05:08.851] [trace] 	node.description: "Built-in Audio HDMI / DisplayPort 2 Output"
[2025-08-01 18:05:08.851] [trace] 	node.name: "alsa_output.platform-avs_hdaudio.2.HiFi__HDMI2__sink"
[2025-08-01 18:05:08.851] [trace] 	node.nick: "HDMI / DisplayPort 2 Output"
[2025-08-01 18:05:08.851] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:05:08.851] [trace] object id: 60
[2025-08-01 18:05:08.851] [trace] 	object.serial: "2505"
[2025-08-01 18:05:08.851] [trace] 	object.path: "alsa:acp:hdaudioB0D2:2:playback"
[2025-08-01 18:05:08.851] [trace] 	factory.id: "19"
[2025-08-01 18:05:08.851] [trace] 	client.id: "46"
[2025-08-01 18:05:08.851] [trace] 	device.id: "47"
[2025-08-01 18:05:08.851] [trace] 	priority.session: "728"
[2025-08-01 18:05:08.851] [trace] 	priority.driver: "728"
[2025-08-01 18:05:08.851] [trace] 	node.description: "Built-in Audio HDMI / DisplayPort 1 Output"
[2025-08-01 18:05:08.851] [trace] 	node.name: "alsa_output.platform-avs_hdaudio.2.HiFi__HDMI1__sink"
[2025-08-01 18:05:08.851] [trace] 	node.nick: "HDMI / DisplayPort 1 Output"
[2025-08-01 18:05:08.851] [trace] 	media.class: "Audio/Sink"
[2025-08-01 18:05:08.851] [info] select audio endpoint: 31, Audio Share Sink
[2025-08-01 18:05:08.875] [trace] stream node id: 112
[2025-08-01 18:05:08.875] [trace] stream properties:
[2025-08-01 18:05:08.875] [trace] 	media.type = "Audio"
[2025-08-01 18:05:08.875] [trace] 	media.category = "Capture"
[2025-08-01 18:05:08.875] [trace] 	media.role = "Music"
[2025-08-01 18:05:08.875] [trace] 	application.name = "Audio Share Server"
[2025-08-01 18:05:08.875] [trace] 	node.name = "Audio Share Server"
[2025-08-01 18:05:08.875] [trace] 	target.object = "31"
[2025-08-01 18:05:08.875] [trace] 	media.name = "audio-share-server"
[2025-08-01 18:05:08.875] [trace] 	stream.is-live = "true"
[2025-08-01 18:05:08.875] [trace] 	node.want-driver = "true"
[2025-08-01 18:05:08.875] [trace] 	node.autoconnect = "true"
[2025-08-01 18:05:08.875] [trace] 	media.class = "Stream/Input/Audio"
[2025-08-01 18:05:08.875] [trace] 	object.serial = "5091"
[2025-08-01 18:05:08.875] [trace] 	factory.id = "9"
[2025-08-01 18:05:08.875] [trace] 	client.id = "109"
[2025-08-01 18:05:08.875] [info] stream name: audio-share-server
[2025-08-01 18:05:08.875] [info] audio_info.info.raw.format: 283
[2025-08-01 18:05:08.875] [info] the capture format is supported
[2025-08-01 18:05:08.875] [info] block_align: 8
[2025-08-01 18:05:08.876] [info] AudioFormat:
encoding: ENCODING_PCM_FLOAT
channels: 2
sample_rate: 48000

[2025-08-01 18:05:08.877] [trace] now:31320020141999 rate:1/48000 ticks:0 delay:0 queued:0
[2025-08-01 18:05:09.877] [trace] now:31333803202841 rate:1/48000 ticks:48128 delay:0 queued:0
[2025-08-01 18:05:10.877] [trace] now:31334805869492 rate:1/48000 ticks:96256 delay:0 queued:0
[2025-08-01 18:05:11.207] [info] accept 192.168.1.199:43982
[2025-08-01 18:05:11.208] [trace] cmd 1
[2025-08-01 18:05:11.272] [trace] cmd 2
[2025-08-01 18:05:11.273] [trace] add_playing_peer add id:1 tcp://192.168.1.199:43982
[2025-08-01 18:05:11.299] [info] fill_udp_peer fill udp peer id:1 tcp://192.168.1.199:43982 udp://192.168.1.199:46021
[2025-08-01 18:05:11.877] [trace] now:31335808536143 rate:1/48000 ticks:144384 delay:0 queued:0
[2025-08-01 18:05:12.877] [trace] now:31336811202794 rate:1/48000 ticks:192512 delay:0 queued:0
[2025-08-01 18:05:13.877] [trace] now:31337813869445 rate:1/48000 ticks:240640 delay:0 queued:0
[2025-08-01 18:05:14.278] [trace] cmd 3
[2025-08-01 18:05:14.877] [trace] now:31338816536096 rate:1/48000 ticks:288768 delay:0 queued:0
[2025-08-01 18:05:15.877] [trace] now:31339797869414 rate:1/48000 ticks:335872 delay:0 queued:0
[2025-08-01 18:05:16.877] [trace] now:31340779202732 rate:1/48000 ticks:382976 delay:0 queued:0
[2025-08-01 18:05:17.279] [trace] cmd 3
[2025-08-01 18:05:17.877] [trace] now:31341803202716 rate:1/48000 ticks:432128 delay:0 queued:0
[2025-08-01 18:05:18.877] [trace] now:31342784536034 rate:1/48000 ticks:479232 delay:0 queued:0
[2025-08-01 18:05:19.877] [trace] now:31343808536018 rate:1/48000 ticks:528384 delay:0 queued:0
[2025-08-01 18:05:20.291] [trace] cmd 3

Could you please take a look? Thanks again!

scorpiofifth avatar Aug 01 '25 10:08 scorpiofifth