Skip to content

Commit ec59be3

Browse files
author
RaspberryPiFpcHub
committed
v1.0.4
1 parent e32b210 commit ec59be3

File tree

12 files changed

+483
-191
lines changed

12 files changed

+483
-191
lines changed

CHANGELOG.md

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

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

5+
## [1.0.4] – 2025-08-18
6+
###Added
7+
- Option to select the audio output device (Headphones/Jack, HDMI, USB sound card).
8+
59
## [1.0.3] – 2025-08-13
610
### Fixed
711
- Crash when the settings form was closed while no sound was being played.

README.md

Lines changed: 76 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,102 +2,118 @@
22

33
UDP network audio receiver for Raspberry Pi with very low latency via ALSA.
44

5-
The program automatically detects whether packets are being received:
5+
---
66

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.
7+
## ⚡ Quick Start
138

14-
---
9+
### Sender (System Audio)
1510

16-
## 💠 Requirements
11+
1. Install ffmpeg:
1712

18-
- Raspberry Pi running Debian Bookworm
19-
- ALSA installed
20-
- Network connection for receiving UDP packets
13+
```bash
14+
sudo apt install ffmpeg
15+
```
2116

22-
---
17+
2. Edit the provided `StartFFmpegTransmitter.sh` script:
2318

24-
## 🧪 Test Setup
19+
* Replace the IP address with your receiver's IP.
20+
* Set the port number to match the receiver configuration.
21+
3. Make the script executable:
2522

26-
Example setup used during development and verification:
23+
```bash
24+
chmod +x StartFFmpegTransmitter.sh
25+
```
2726

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.
27+
4. Place the script on the desktop and double-click to start transmitting.
3128

32-
This setup demonstrated stable low-latency streaming under typical home network conditions.
29+
### Receiver
3330

34-
---
31+
1. Start the player:
3532

36-
## ▶️ Usage
33+
```bash
34+
./udp_player
35+
```
3736

38-
### 📤 Sender (System Audio)
39-
Install `ffmpeg`:
37+
2. The window will appear and start playback automatically when UDP packets are received.
38+
3. Choose the audio output device in settings (3.5 mm jack, HDMI, USB, and more).
4039

41-
sudo apt install ffmpeg
40+
**Silence Handling:**
4241

43-
To transmit system audio, use the provided startup script **`StartFFmpegTransmitter.sh`**:
42+
* If no audio packets arrive for 5 seconds, ALSA stops and releases the output.
43+
* Playback resumes automatically when new packets arrive.
4444

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
45+
---
5046

51-
Save the file, place it on the desktop, and start it with a double-click.
47+
## ✨ Features
5248

53-
### 📥 Receiver
49+
* UDP audio streaming with very low latency
50+
* Uncompressed audio for maximum quality
51+
* Automatic detection of incoming audio packets
52+
* Silence handling with automatic ALSA release and re-initialization
53+
* Selectable audio output (3.5 mm jack, HDMI, USB, and more)
54+
* Adjustable latency per output device:
55+
* 3.5 mm jack ≈ 22000 (=22 ms)
56+
* USB audio stick ≈ 3000 (=3 ms)
57+
* Start minimized option
58+
* Separate settings window for configuration
59+
* Startup script provided for FFmpeg sender
5460

55-
Start the player:
61+
---
5662

57-
./udp_player
63+
## 💠 Requirements
5864

59-
A window appears and starts playback automatically when UDP packets arrive.
65+
* Raspberry Pi running Debian Bookworm
66+
* ALSA installed
67+
* Network connection for receiving UDP packets
6068

6169
---
6270

63-
### 📥 Receiver
71+
## 🧪 Test Setup
72+
73+
* **Sender**: Raspberry Pi 4 playing YouTube videos via Wi-Fi.
74+
* **Receiver**: Another Raspberry Pi 4 connected via LAN.
75+
* Receiver audio output connected to HiFi receiver (3.5 mm jack, HDMI, or USB).
6476

65-
Start the receiver:
66-
```bash
67-
./udp_player
68-
```
77+
---
78+
79+
## ▶️ Usage
80+
81+
Refer to the Quick Start section above.
6982

70-
The receiver window will appear and automatically start playing audio when UDP packets are received.
83+
**Audio Output Selection:**
7184

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.
85+
* Choose your desired output device in settings.
86+
* Supported outputs: 3.5 mm jack, HDMI, USB, and more.
87+
88+
**Silence Handling:**
89+
90+
* ALSA output stops after 5 seconds of no packets and restarts automatically when new packets arrive.
7491

7592
---
7693

7794
## 🎯 Optimization Notes
7895

79-
Audio latency can be configured in the receiver application:
96+
* **Lower buffer size** → lower audio delay
97+
* **Too low** → possible dropouts or crackling audio
98+
* **Best settings depend on:**
8099

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.
100+
* **Network type**: LAN generally allows lower latency than Wi-Fi
101+
* **Raspberry Pi performance**: CPU load affects real-time audio
102+
* **Audio hardware**: output device and drivers
103+
* **Network traffic**: heavy traffic may cause packet loss or jitter
84104

85-
Optimal settings depend on:
105+
**Approximate latency values per output device (1000 units = 1 ms):**
86106

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
107+
* 3.5 mm jack → \~22000 (=22 ms)
108+
* USB audio stick → \~3000 (=3 ms)
90109

91110
---
92111

93112
## 🔊 If the audio is too quiet
94113

95-
This may occur if the receiver volume is set too low.
114+
* Use `alsamixer` (F6 to select device) and increase volume.
115+
* Or via terminal:
96116

97-
### Possible solutions:
98-
99-
- Use `alsamixer`, press `F6` to select the correct device, and increase the volume
100-
- Or via terminal:
101117
```bash
102118
amixer set 'Master' 100% unmute
103119
```
@@ -106,4 +122,7 @@ amixer set 'Master' 100% unmute
106122

107123
## 📝 License
108124

109-
This project is licensed under the MIT License.
125+
MIT License.
126+
127+
**Audio Output Update:**
128+
Playback is now supported via 3.5 mm jack, HDMI, USB, and more. Select the desired device in the settings window.

bin/README.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Network Audio Receiver (UDP) for Raspberry Pi (FPC)
2+
3+
UDP network audio receiver for Raspberry Pi with very low latency via ALSA.
4+
5+
---
6+
7+
## ⚡ Quick Start
8+
9+
### Sender (System Audio)
10+
11+
1. Install ffmpeg:
12+
13+
```bash
14+
sudo apt install ffmpeg
15+
```
16+
17+
2. Edit the provided `StartFFmpegTransmitter.sh` script:
18+
19+
* Replace the IP address with your receiver's IP.
20+
* Set the port number to match the receiver configuration.
21+
3. Make the script executable:
22+
23+
```bash
24+
chmod +x StartFFmpegTransmitter.sh
25+
```
26+
27+
4. Place the script on the desktop and double-click to start transmitting.
28+
29+
### Receiver
30+
31+
1. Start the player:
32+
33+
```bash
34+
./udp_player
35+
```
36+
37+
2. The window will appear and start playback automatically when UDP packets are received.
38+
3. Choose the audio output device in settings (3.5 mm jack, HDMI, USB, and more).
39+
40+
**Silence Handling:**
41+
42+
* If no audio packets arrive for 5 seconds, ALSA stops and releases the output.
43+
* Playback resumes automatically when new packets arrive.
44+
45+
---
46+
47+
## ✨ Features
48+
49+
* UDP audio streaming with very low latency
50+
* Uncompressed audio for maximum quality
51+
* Automatic detection of incoming audio packets
52+
* Silence handling with automatic ALSA release and re-initialization
53+
* Selectable audio output (3.5 mm jack, HDMI, USB, and more)
54+
* Adjustable latency per output device:
55+
* 3.5 mm jack ≈ 22000 (=22 ms)
56+
* USB audio stick ≈ 3000 (=3 ms)
57+
* Start minimized option
58+
* Separate settings window for configuration
59+
* Startup script provided for FFmpeg sender
60+
61+
---
62+
63+
## 💠 Requirements
64+
65+
* Raspberry Pi running Debian Bookworm
66+
* ALSA installed
67+
* Network connection for receiving UDP packets
68+
69+
---
70+
71+
## 🧪 Test Setup
72+
73+
* **Sender**: Raspberry Pi 4 playing YouTube videos via Wi-Fi.
74+
* **Receiver**: Another Raspberry Pi 4 connected via LAN.
75+
* Receiver audio output connected to HiFi receiver (3.5 mm jack, HDMI, or USB).
76+
77+
---
78+
79+
## ▶️ Usage
80+
81+
Refer to the Quick Start section above.
82+
83+
**Audio Output Selection:**
84+
85+
* Choose your desired output device in settings.
86+
* Supported outputs: 3.5 mm jack, HDMI, USB, and more.
87+
88+
**Silence Handling:**
89+
90+
* ALSA output stops after 5 seconds of no packets and restarts automatically when new packets arrive.
91+
92+
---
93+
94+
## 🎯 Optimization Notes
95+
96+
* **Lower buffer size** → lower audio delay
97+
* **Too low** → possible dropouts or crackling audio
98+
* **Best settings depend on:**
99+
100+
* **Network type**: LAN generally allows lower latency than Wi-Fi
101+
* **Raspberry Pi performance**: CPU load affects real-time audio
102+
* **Audio hardware**: output device and drivers
103+
* **Network traffic**: heavy traffic may cause packet loss or jitter
104+
105+
**Approximate latency values per output device (1000 units = 1 ms):**
106+
107+
* 3.5 mm jack → \~22000 (=22 ms)
108+
* USB audio stick → \~3000 (=3 ms)
109+
110+
---
111+
112+
## 🔊 If the audio is too quiet
113+
114+
* Use `alsamixer` (F6 to select device) and increase volume.
115+
* Or via terminal:
116+
117+
```bash
118+
amixer set 'Master' 100% unmute
119+
```
120+
121+
---
122+
123+
## 📝 License
124+
125+
MIT License.
126+
127+
**Audio Output Update:**
128+
Playback is now supported via 3.5 mm jack, HDMI, USB, and more. Select the desired device in the settings window.

bin/udp_player

192 Bytes
Binary file not shown.

bin/udp_player.conf

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

0 commit comments

Comments
 (0)