Audio Share can share Windows/Linux computer's audio to Android phone over network, so your phone becomes the speaker of computer. (You needn't buy a new speaker😄.)
192.168.3.2
. Make sure your phone can connect your computer over this IP address. Then Click "Start Server" button.192.168.3.2
. Click "▶" button and enjoy the audio🎶.[!CAUTION] This app doesn't support auto reconnecting feature at present. Once the app is killed or disconnected by Android power saver, the audio playing will be stop. Adding app to the whitelist of power saver is recommended. To do this, you can press "Request Ignore Battery Optimizations" on app's Settings.
audio-share-server-cmd-windows.zip
for Windows, the audio-share-server-cmd-linux.tar.gz
for Linux.192.168.3.2
. Then run as-cmd -b 192.168.3.2
to start the server. It will use the default port 65530
and select a default audio endpoint.192.168.3.2
. Click "▶" button and enjoy the audio🎶.address=192.168.3.2 # change it.
port=65530 # change it.
sudo firewall-cmd --add-rich-rule="rule family=ipv4 destination address=$address port port=$port protocol=tcp accept"
sudo firewall-cmd --add-rich-rule="rule family=ipv4 destination address=$address port port=$port protocol=udp accept"
sudo firewall-cmd --runtime-to-permanent
sudo firewall-cmd --list-rich-rules
Output:
rule family="ipv4" destination address="192.168.3.2" port port="65530" protocol="tcp" accept
rule family="ipv4" destination address="192.168.3.2" port port="65530" protocol="udp" accept
address=192.168.3.2 # change it.
port=65530 # change it.
sudo firewall-cmd --remove-rich-rule="rule family=ipv4 destination address=$address port port=$port protocol=tcp accept"
sudo firewall-cmd --remove-rich-rule="rule family=ipv4 destination address=$address port port=$port protocol=udp accept"
sudo firewall-cmd --runtime-to-permanent
There are two kinds of audio format:
The transfer audio format is uncompressed PCM data and keep same with capture audio format.
You can open server.log
to see the capture audio format.
[2024-02-11 22:27:33.019] [server] [info] AudioFormat:
format_tag: 3
channels: 2
sample_rate: 192000
bits_per_sample: 32
As shown above, the format is 32 bit float
, the channel count is 2
, and sample rate is 192kHz
.
On Windows, the capture audio format is the default value given by Windows Core Audio APIs. It seems like always be 32 bit float
. The sample rate is affected by audio endpoint format. You may change it by setting System Sounds Panel(mmsys.cpl
). In Playback
tab, right click one available endpoint, and open Properties Panel, and select Advanced
tab, and change Default Format
and click Apply
. This can be also done in Realtek Audio Console
, if you use a Realtek Audio Card.
On Linux, the capture audio format is hardcoded. To keep same with Windows, the audio format is also 32 bit float
. The channel count is always 2
. The sample rate is always 48kHz
.
Note that the higher sample rate will consume more network traffic bandwidth. Maybe in future, the capture audio format can be set by user manually.
The final volume that you hear is affected by the following volume:
They are all independent. If you max the volume of your PC and audio player, and still feel it's not enough, but don't want to change the Android system volume, you can increase "Loudness Enhancer" on app's Settings. It won't affect the system volume. The "Audio Volume" on app can decrease the volume you hear without changing system volume.
Too much loudness will hurt your ear!!! "Loudness Enhancer" has a limit of 3000mB
. It's enough for most cases. If you still need more loudness, just directly change Android system volume.
Realtek sound card can make audio endpoint available when speaker doesn't plug in. Just open Realtek Audio Console, select "Device advanced settings" tab, and switch on "Disable front panel front popup dialog" option. Then the audio endpoint will show up. Other sound card may have similar options. If you can't find, then turn to Method 2.
At present, I haven't find a way to create virtual audio endpoint. The only way to achieve it is to write a virtual audio device driver. But it need a EV Code Signing Certificate to sign it. Otherwise, user can't install it. I don't want to pay for it. And there are many existed third-party virtual audio device drivers. You can find one or post one that you know at Virtual Audio Device Driver on Windows. Generally, a driver has an INF file. Right click it and click "Install" to install it.
Thanks to PipeWire, it's very easy for Linux to create a virtual audio endpoint, even without a root privilege. Just copy the below config to ~/.config/pipewire/pipewire.conf.d/audio-share-sink.conf
context.objects = [
{ factory = adapter
args = {
factory.name = support.null-audio-sink
node.name = "Audio Share Sink"
media.class = Audio/Sink
object.linger = true
audio.position = [ FL FR ]
priority.session = 1009
priority.driver = 1009
monitor.channel-volumes = true
monitor.passthrough = true
}
}
]
Then run systemctl --user restart pipewire
to restart the PipeWire service.
Finally, you can see the added endpoint "Audio Share Sink".
[abc@localhost ~]$ as-cmd -l
[2024-03-17 22:46:14.563] [info] pipewire header_version: 0.3.48, library_version: 0.3.67
endpoint_list:
* id: 30 name: Audio Share Sink
total: 1
Android App
Server MFC
vcpkg install asio protobuf spdlog[wchar] wil nlohmann-json
to install deps. The vcpkg triplet is x64-windows-static-md
.Server CMD
libpipewire-dev
or pipewire-devel
.VPCKG_ROOT
env. This env is required by CMakePresets.json
.vcpkg install asio protobuf spdlog cxxopts
to install deps. The vcpkg triplet is x64-windows-static-md
for Windows, x64-linux
for Linux.cmake --preset linux-Release
to configure.cmake --build --preset linux-Release
to build. The as-cmd
is located at out/install/linux-Release/bin/as-cmd
.linux
to windows
in previous two steps.This project is licensed under the Apache-2.0 license .
Copyright 2022-2024 mkckr0 <https://github.com/mkckr0>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.