Skip to content

Commit 1d6daa8

Browse files
author
RaspberryPiFpcHub
committed
v1.0.5
1 parent e32b210 commit 1d6daa8

File tree

16 files changed

+996
-368
lines changed

16 files changed

+996
-368
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22

33
All notable changes to this project are documented in this file.
44

5+
## [1.0.5] – 2025-09-23
6+
### Fixed
7+
- Port setting: default value 5010 and alternative configurations now work correctly.
8+
- Endian setting now functions as expected.
9+
- Config file handling is now Linux-conform, stored at `/home/pi/.config/udp_player.cfg`.
10+
11+
### Added
12+
- Separate settings for all available audio outputs.
13+
- VU meter display for audio signal levels.
14+
15+
## [1.0.4] – 2025-08-18
16+
###Added
17+
- Option to select the audio output device (Headphones/Jack, HDMI, USB sound card).
18+
519
## [1.0.3] – 2025-08-13
620
### Fixed
721
- Crash when the settings form was closed while no sound was being played.

README.md

Lines changed: 87 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,139 @@
1-
# Network Audio Receiver (UDP) for Raspberry Pi (FPC)
2-
3-
UDP network audio receiver for Raspberry Pi with very low latency via ALSA.
1+
---
2+
layout: default
3+
title: Network Audio Receiver (UDP) for Raspberry Pi
4+
description: Lightweight UDP stereo audio receiver for Raspberry Pi with very low latency via ALSA and PipeWire. Developed in Free Pascal on Debian Bookworm.
5+
---
46

5-
The program automatically detects whether packets are being received:
7+
# 🎶 Network Audio Receiver (UDP) for Raspberry Pi
68

7-
- If packets arrive → audio is played.
8-
- For maximum quality, no codec is used – the audio is transmitted uncompressed.
9-
- This allows for very low latency, making it ideal for real-time transmissions (e.g., monitoring, live audio).
10-
- A separate settings window is available.
11-
- If the “Start Minimized” checkbox is selected, the application will start minimized.
12-
- A startup script for an FFmpeg audio sender (`StartFFmpegTransmitter.sh`) is provided. Place it on the desktop and start it with a double-click.
9+
A lightweight **UDP stereo audio receiver** for Raspberry Pi.
10+
It outputs directly to **ALSA** (also compatible with **PipeWire** via ALSA emulation), ensuring **very low latency** – ideal for real-time monitoring and live audio.
1311

1412
---
1513

16-
## 💠 Requirements
17-
18-
- Raspberry Pi running Debian Bookworm
19-
- ALSA installed
20-
- Network connection for receiving UDP packets
14+
## ✨ Features
15+
16+
* Receives **stereo audio over UDP** (e.g., RTP stream) with selectable audio output: 3.5 mm jack, HDMI, USB, and more (choose one device at a time)
17+
* Direct **ALSA audio output** for minimal delay
18+
* Fully compatible with **PipeWire** via ALSA emulation
19+
* Developed in **Free Pascal** using **Codetyphon** on **Debian Bookworm**
20+
* **Automatic detection** of incoming packets:
21+
* Packets arrive → audio plays instantly
22+
* No or silent packets for 5 seconds → audio output stops
23+
* **No codec** → uncompressed audio, maximum quality, minimal processing delay
24+
* Supports multiple audio outputs: **3.5 mm jack, HDMI, USB, and more** (selectable in settings)
25+
* On startup, the window is visible
26+
* If the “Start Minimized” checkbox is selected, the application will start minimized
27+
* **Lightweight** with minimal dependencies (ALSA or PipeWire via ALSA)
2128

2229
---
2330

24-
## 🧪 Test Setup
31+
## 💡 Example Test Setup
2532

26-
Example setup used during development and verification:
33+
* **Sender**: Raspberry Pi 4 streaming YouTube audio via Wi-Fi
34+
* **Receiver**: Raspberry Pi 4 connected via Ethernet
35+
* **Output**: 3.5 mm jack → HiFi amplifier, or HDMI/USB audio
2736

28-
- **Sender**: Raspberry Pi 4 playing YouTube videos in a browser, connected via **2.4 GHz Wi-Fi** to a router.
29-
- **Receiver**: Another Raspberry Pi 4, connected via **Ethernet (LAN)** to the same router.
30-
- Receiver’s **3.5 mm jack audio output** connected to a **HiFi receiver** for playback.
31-
32-
This setup demonstrated stable low-latency streaming under typical home network conditions.
37+
Result: Stable low-latency playback in a typical home network.
3338

3439
---
3540

3641
## ▶️ Usage
3742

3843
### 📤 Sender (System Audio)
44+
3945
Install `ffmpeg`:
4046

47+
```bash
4148
sudo apt install ffmpeg
49+
```
4250

4351
To transmit system audio, use the provided startup script **`StartFFmpegTransmitter.sh`**:
4452

45-
1. Edit the script and replace the IP address with the address of your receiver.
46-
2. Set the port number to match the configuration on the receiver.
47-
3. Make the script executable:
48-
```bash
49-
chmod +x StartFFmpegTransmitter.sh
53+
1. Edit the script and replace the IP address with the address of your receiver.
54+
2. Set the port number to match the configuration on the receiver.
55+
3. Make the script executable:
5056

51-
Save the file, place it on the desktop, and start it with a double-click.
57+
```bash
58+
chmod +x StartFFmpegTransmitter.sh
59+
```
60+
61+
4. Save the file, place it on the desktop, and start it with a double-click.
5262

5363
### 📥 Receiver
5464

5565
Start the player:
5666

57-
./udp_player
58-
59-
A window appears and starts playback automatically when UDP packets arrive.
60-
61-
---
62-
63-
### 📥 Receiver
64-
65-
Start the receiver:
6667
```bash
6768
./udp_player
6869
```
6970

70-
The receiver window will appear and automatically start playing audio when UDP packets are received.
71+
A window appears and starts playback automatically when UDP packets arrive. Select the desired audio output in the settings window.
7172

72-
**Silence Handling:**
73-
If no audio packets—or only silent packets—are received for 5 seconds, the ALSA output is stopped and released. When new packets arrive, ALSA is automatically re-initialized, allowing playback to resume seamlessly.
73+
**Silence Handling:**
7474

75-
---
75+
* If no audio packets arrive for 5 seconds, ALSA stops and releases the output.
76+
* Playback resumes automatically when new packets arrive.
7677

77-
## 🎯 Optimization Notes
78+
---
7879

79-
Audio latency can be configured in the receiver application:
80+
## ⚙️ Settings Description
81+
82+
Control / Field | Description
83+
--- | ---
84+
**Audio Output Selection** | Choose the audio output device (Headphones/JACK, HDMI, USB audio, etc.). If no configuration exists for a device, a default configuration is created automatically at program start.
85+
**IP** | IP address to receive audio from. Use `0.0.0.0` to listen on all network interfaces.
86+
**Port** | UDP port for incoming audio. Default is `5010`.
87+
**Network Buffer** | Size of the receive buffer in bytes. Must be at least as large as a single sent audio block.
88+
**Frequency** | Audio sample rate in Hz.
89+
**Latency** | Audio latency in samples. Typical values: 22000 for JACK/Headphones, 3000 for USB audio.
90+
**Swap Byte Order** | Enable this if the incoming audio uses a different byte order (big/little endian).
91+
**Hide Window** | If enabled, the application window remains minimized or hidden once audio starts.
92+
**Activate** | Immediately applies the current settings without saving them.
93+
**Save** | Saves the current settings to the configuration file for future use.
94+
**Delete Device** | Deletes the selected device configuration. If the device exists, it will be recreated with default values at the next program start.
8095

81-
- **Lower latency values** → reduce audio delay, improving real-time performance.
82-
- **Too low values** → may cause sporadic audio dropouts, depending on network type and stability.
83-
- **Extremely low values** → may result in distorted or crackling audio due to buffer underruns.
96+
---
8497

85-
Optimal settings depend on:
98+
## 🎯 Latency Optimization
8699

87-
- Network quality and stability
88-
- Connection type (LAN generally allows lower latency than Wi-Fi)
89-
- Performance of the Raspberry Pi and audio output hardware
100+
* **Lower buffer size** → lower delay
101+
* **Too low** → possible dropouts or crackling audio
102+
* Best settings depend on:
103+
* Network type (**LAN** allows lower latency than Wi-Fi)
104+
* Raspberry Pi performance
105+
* Audio hardware
90106

91107
---
92108

93-
## 🔊 If the audio is too quiet
109+
## 🔊 Audio Volume
110+
111+
If sound is too quiet:
94112

95-
This may occur if the receiver volume is set too low.
113+
```bash
114+
alsamixer
115+
```
96116

97-
### Possible solutions:
117+
* Press `F6` to select the right device
118+
* Raise the **Master** volume
119+
120+
Or via terminal:
98121

99-
- Use `alsamixer`, press `F6` to select the correct device, and increase the volume
100-
- Or via terminal:
101122
```bash
102123
amixer set 'Master' 100% unmute
103124
```
104125

105126
---
106127

107-
## 📝 License
128+
## 📜 License
129+
130+
This project is licensed under the **MIT License**.
131+
132+
---
133+
134+
## 🌐 Other Projects by the Author
108135

109-
This project is licensed under the MIT License.
136+
* [pibackup](https://github.com/RaspberryFpc/pibackup) – Portable live backup and restore tool with GUI, Zstandard compression, auto-shrinking (resize2fs) and flexible restore options.
137+
* [DS18B20-FPC-Pi-GUI](https://github.com/RaspberryFpc/DS18B20-FPC-Pi-GUI) – GUI tool to read DS18B20 temperature sensors with linearization for high accuracy.
138+
* [RaspberryPi-BME280-GUI](https://github.com/RaspberryFpc/RaspberryPi-BME280-GUI) – Complete GUI application for accessing the BME280 I²C sensor using Free Pascal.
139+
* [RaspberryPi-GPIOv2-FPC](https://github.com/RaspberryFpc/RaspberryPi-GPIOv2-FPC) – Simple and fast Pascal unit for controlling GPIO pins via the Linux GPIO character device interface.

bin/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
---
2+
layout: default
3+
title: Network Audio Receiver (UDP) for Raspberry Pi
4+
description: Lightweight UDP stereo audio receiver for Raspberry Pi with very low latency via ALSA and PipeWire. Developed in Free Pascal on Debian Bookworm.
5+
---
6+
7+
# 🎶 Network Audio Receiver (UDP) for Raspberry Pi
8+
9+
A lightweight **UDP stereo audio receiver** for Raspberry Pi.
10+
It outputs directly to **ALSA** (also compatible with **PipeWire** via ALSA emulation), ensuring **very low latency** – ideal for real-time monitoring and live audio.
11+
12+
---
13+
14+
## ✨ Features
15+
16+
* Receives **stereo audio over UDP** (e.g., RTP stream) with selectable audio output: 3.5 mm jack, HDMI, USB, and more (choose one device at a time)
17+
* Direct **ALSA audio output** for minimal delay
18+
* Fully compatible with **PipeWire** via ALSA emulation
19+
* Developed in **Free Pascal** using **Codetyphon** on **Debian Bookworm**
20+
* **Automatic detection** of incoming packets:
21+
* Packets arrive → audio plays instantly
22+
* No or silent packets for 5 seconds → audio output stops
23+
* **No codec** → uncompressed audio, maximum quality, minimal processing delay
24+
* Supports multiple audio outputs: **3.5 mm jack, HDMI, USB, and more** (selectable in settings)
25+
* On startup, the window is visible
26+
* If the “Start Minimized” checkbox is selected, the application will start minimized
27+
* **Lightweight** with minimal dependencies (ALSA or PipeWire via ALSA)
28+
29+
---
30+
31+
## 💡 Example Test Setup
32+
33+
* **Sender**: Raspberry Pi 4 streaming YouTube audio via Wi-Fi
34+
* **Receiver**: Raspberry Pi 4 connected via Ethernet
35+
* **Output**: 3.5 mm jack → HiFi amplifier, or HDMI/USB audio
36+
37+
Result: Stable low-latency playback in a typical home network.
38+
39+
---
40+
41+
## ▶️ Usage
42+
43+
### 📤 Sender (System Audio)
44+
45+
Install `ffmpeg`:
46+
47+
```bash
48+
sudo apt install ffmpeg
49+
```
50+
51+
To transmit system audio, use the provided startup script **`StartFFmpegTransmitter.sh`**:
52+
53+
1. Edit the script and replace the IP address with the address of your receiver.
54+
2. Set the port number to match the configuration on the receiver.
55+
3. Make the script executable:
56+
57+
```bash
58+
chmod +x StartFFmpegTransmitter.sh
59+
```
60+
61+
4. Save the file, place it on the desktop, and start it with a double-click.
62+
63+
### 📥 Receiver
64+
65+
Start the player:
66+
67+
```bash
68+
./udp_player
69+
```
70+
71+
A window appears and starts playback automatically when UDP packets arrive. Select the desired audio output in the settings window.
72+
73+
**Silence Handling:**
74+
75+
* If no audio packets arrive for 5 seconds, ALSA stops and releases the output.
76+
* Playback resumes automatically when new packets arrive.
77+
78+
---
79+
80+
## ⚙️ Settings Description
81+
82+
Control / Field | Description
83+
--- | ---
84+
**Audio Output Selection** | Choose the audio output device (Headphones/JACK, HDMI, USB audio, etc.). If no configuration exists for a device, a default configuration is created automatically at program start.
85+
**IP** | IP address to receive audio from. Use `0.0.0.0` to listen on all network interfaces.
86+
**Port** | UDP port for incoming audio. Default is `5010`.
87+
**Network Buffer** | Size of the receive buffer in bytes. Must be at least as large as a single sent audio block.
88+
**Frequency** | Audio sample rate in Hz.
89+
**Latency** | Audio latency in samples. Typical values: 22000 for JACK/Headphones, 3000 for USB audio.
90+
**Swap Byte Order** | Enable this if the incoming audio uses a different byte order (big/little endian).
91+
**Hide Window** | If enabled, the application window remains minimized or hidden once audio starts.
92+
**Activate** | Immediately applies the current settings without saving them.
93+
**Save** | Saves the current settings to the configuration file for future use.
94+
**Delete Device** | Deletes the selected device configuration. If the device exists, it will be recreated with default values at the next program start.
95+
96+
---
97+
98+
## 🎯 Latency Optimization
99+
100+
* **Lower buffer size** → lower delay
101+
* **Too low** → possible dropouts or crackling audio
102+
* Best settings depend on:
103+
* Network type (**LAN** allows lower latency than Wi-Fi)
104+
* Raspberry Pi performance
105+
* Audio hardware
106+
107+
---
108+
109+
## 🔊 Audio Volume
110+
111+
If sound is too quiet:
112+
113+
```bash
114+
alsamixer
115+
```
116+
117+
* Press `F6` to select the right device
118+
* Raise the **Master** volume
119+
120+
Or via terminal:
121+
122+
```bash
123+
amixer set 'Master' 100% unmute
124+
```
125+
126+
---
127+
128+
## 📜 License
129+
130+
This project is licensed under the **MIT License**.
131+
132+
---
133+
134+
## 🌐 Other Projects by the Author
135+
136+
* [pibackup](https://github.com/RaspberryFpc/pibackup) – Portable live backup and restore tool with GUI, Zstandard compression, auto-shrinking (resize2fs) and flexible restore options.
137+
* [DS18B20-FPC-Pi-GUI](https://github.com/RaspberryFpc/DS18B20-FPC-Pi-GUI) – GUI tool to read DS18B20 temperature sensors with linearization for high accuracy.
138+
* [RaspberryPi-BME280-GUI](https://github.com/RaspberryFpc/RaspberryPi-BME280-GUI) – Complete GUI application for accessing the BME280 I²C sensor using Free Pascal.
139+
* [RaspberryPi-GPIOv2-FPC](https://github.com/RaspberryFpc/RaspberryPi-GPIOv2-FPC) – Simple and fast Pascal unit for controlling GPIO pins via the Linux GPIO character device interface.

bin/StartFFmpegTransmitter.sh

100644100755
File mode changed.

bin/udp_player

100755100644
671 KB
Binary file not shown.

bin/udp_player.conf

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)