|
| 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. 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**, 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) |
| 17 | +- Direct **ALSA audio output** for minimal delay |
| 18 | +- Developed in **Free Pascal** using **Codetyphon** on **Debian Bookworm** |
| 19 | +- **Automatic detection** of incoming packets: |
| 20 | + - Packets arrive → audio plays instantly |
| 21 | + - No or silent packets for 5 seconds → audio output stops |
| 22 | +- **No codec** → uncompressed audio, maximum quality, minimal processing delay |
| 23 | +- Optional **Hide mode**: |
| 24 | + - On startup, the window is visible |
| 25 | + - If the **Hide** checkbox is enabled, the window auto-minimizes when audio is received and stays hidden until disabled |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## 💡 Example Test Setup |
| 30 | + |
| 31 | +- **Sender**: Raspberry Pi 4 streaming YouTube audio via Wi-Fi |
| 32 | +- **Receiver**: Raspberry Pi 4 connected via Ethernet |
| 33 | +- **Output**: 3.5 mm jack → HiFi amplifier |
| 34 | + |
| 35 | +Result: Stable low-latency playback in a typical home network. |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## ▶️ Usage |
| 40 | + |
| 41 | +### 📤 Sender (FFmpeg example) |
| 42 | + |
| 43 | +Install `ffmpeg`: |
| 44 | + |
| 45 | +sudo apt install ffmpeg |
| 46 | + |
| 47 | +Start transmitting system audio with the provided script `StartFFmpegTransmitter.sh`. |
| 48 | +- Replace the IP address with your receiver’s address |
| 49 | +- Choose a matching port |
| 50 | + |
| 51 | +Double-click the script to start streaming. |
| 52 | + |
| 53 | +### 📥 Receiver |
| 54 | + |
| 55 | +Start the player: |
| 56 | + |
| 57 | +./udp_player |
| 58 | + |
| 59 | +A window appears and starts playback automatically when UDP packets arrive. |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## 🎯 Latency Optimization |
| 64 | + |
| 65 | +- **Lower buffer size** → lower delay |
| 66 | +- **Too low** → possible dropouts or crackling audio |
| 67 | +- Best settings depend on: |
| 68 | + - Network type (**LAN** allows lower latency than Wi-Fi) |
| 69 | + - Raspberry Pi performance |
| 70 | + - Audio hardware |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## 🔊 Audio Volume |
| 75 | + |
| 76 | +If sound is too quiet: |
| 77 | + |
| 78 | +alsamixer |
| 79 | + |
| 80 | +- Press `F6` to select the right device |
| 81 | +- Raise the **Master** volume |
| 82 | + |
| 83 | +Or via terminal: |
| 84 | + |
| 85 | +amixer set 'Master' 100% unmute |
| 86 | + |
| 87 | +--- |
| 88 | + |
| 89 | +## 📜 License |
| 90 | + |
| 91 | +This project is licensed under the **MIT License**. |
| 92 | + |
0 commit comments