26
November
2024
Broadcast sound from a computer over a network to a smartphone using the SoundWire server
16:46

Broadcast sound from a computer over a network to a smartphone using the SoundWire server

26 November 2024 16:46

For transmission to wireless headphones, Bluetooth is usually used, the radius of which is several meters. Using SoundWire, you can expand the availability of sound to an apartment or office where there is a Wi-Fi network.

Description of the task

The task consists of three parts:

1)sound source- webcam with microphone, sound card input or Shortwave or WebSDR program in the browser
2)server for digitizing and transmitting sound over the network soundWire (free) for Linux
3)sound client for playing on a smartphone speaker- SoundWireFree for Android OS

Why SoundWire?

I didn't want to use other servers and clients, such as Shoutcast or Tizonia, since the SoundWire option seemed simpler.

About the SoundWire server

There are versions of the SoundWire server for various operating systems:

*Windows 7/8/10/11

  • Linux 64-bit (3.0 Qt5)

  • Linux 32-bit (2.1.2 Qt4)

  • Raspberry Pi 32/64-bit (3.1 & 2.1.2)
    *WinXP

  • Linux (all)

The distribution download is available from the home page https://georgielabs.net/. Since I have Linux Green x64 and Linux Mint x64 OS, so I downloaded the version Linux x64 QT5(tar.gz archive).

SoundWire Server Installation

Server (PC):

  • File SoundWire_Server_linux64.tar.gz unpacked to ~/Downloads/SoundWireServer folder
  • Started the SoundWireServer server:

To work, you need a library - the libportaudio2 dependency.

sudo apt install libportaudio2

To work, you need to open two UDP ports to the outside on the PC firewall:

sudo ufw allow 59010/udp
sudo ufw allow 59011/udp

Starting the server.

cd ~/Загрузки/SoundWireServer/
./SoundWireServer

The server begins to “record” sound in the system and broadcast it to the network. More precisely, the server starts transmitting data when connecting to port 59010 of the client. The second port 59011 is used to locate the server.

You can set the sound source in the "Volume Control" PulseAudio pavucontrol, which is launched by the "Open Pulseaudio Volume Control" button or in another way.
In the "Volume Control" we change the sound source, for example, to a webcam, which will be located next to the radio station being received.

Setting up pavucontrol for a webcam:
webcam

Webcam with microphone:
mic

If the goal is to broadcast sound from an application, for example, Shortwave (Internet radio station), we start playback in it. The sound source in this case is Easy Effects sink(removal of sound from the program)

shortwave_radio

Setting up pavucontrol for Shortwave:
easyeffects

Permanent server IP address

It is necessary to fix the IP address - instead of dynamic IP, make it static (on the router).
Then, write down the IP address of the computer running the SoundWire server

ip addr

Upsampling frequency from 44100 to 48000 Hz

Terminated the SoundWire server and set the sample rate variable and started the server:

export SOUNDWIRE_SERVER_SAMPLE_RATE=48000
./SoundWireServer

Installing and configuring the Android client

The client application can be installed from the store Google Play:

*I recommend "SoundWire - Audio Streaming"

We launch the server on the PC.
On the client in the application, you need to specify the server IP address and press "Enter",
when connected, the spiral symbol in the window will light up more brightly.
client

Problems and solutions

1) The free version displays the message “Free version” once every 30 minutes. You can buy full version of SoundWire, but you can do nothing.

2) No sound - set the sound source in pavucontrol to "Monitor of Build-In Audio Analog Stereo" or webcam.

3) Sometimes the sound is interrupted. - if you view pages in a web browser, the processor performance is not enough. Also, in the Android client settings, check the buffer size - I recommend 64 or 128 kB.

buffer

Network speed requirements

Download speed 250 kbit/s, upload speed 120 kbit/s.
sysmon

Accessing the server on your home network from the Internet

See previous articles:
setting up L2TP on the router
setting up PPTP on the router
*setting up SSTP on the router



Related publications