Skip to content

Commit 89776ae

Browse files
authored
Add files via upload
1 parent 769b2fa commit 89776ae

File tree

8 files changed

+449
-0
lines changed

8 files changed

+449
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 RaspberryPiFpcHub
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.en.md

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# UDP Audio Receiver for Raspberry Pi (FPC / Qt5 / X11)
2+
3+
This program receives audio data over UDP (e.g., RTP stream) and outputs it via ALSA. It was developed in Free Pascal using Codetyphon with Qt5 and runs under X11 on Debian Bookworm.
4+
5+
The program automatically detects whether packets are being received:
6+
- If packets arrive → Audio is played.
7+
- If no packets are received for 5 seconds → Audio output stops, window is hidden.
8+
9+
---
10+
11+
## 💠 Requirements
12+
13+
- Raspberry Pi with Debian Bookworm
14+
- Codetyphon with Qt5 (e.g., qt5pas; GTK2 should work as well)
15+
- ALSA installed
16+
- Network connection for receiving UDP packets
17+
18+
---
19+
20+
## 🔧 Compilation
21+
22+
1. Ensure Codetyphon is installed and set up.
23+
2. Open the project in Codetyphon.
24+
3. Set the widgetset to `Qt5` (alternatively `gtk2`).
25+
4. Compile.
26+
27+
Alternatively, via command line:
28+
```bash
29+
fpc -Mdelphi -Fu/path/to/qt5-units your_program.pas
30+
```
31+
32+
---
33+
34+
## ▶️ Usage
35+
36+
### 📤 Sender (System Audio)
37+
38+
The sender transmits system audio – everything normally played through the speaker.
39+
40+
If not yet installed, install `ffmpeg`:
41+
```bash
42+
sudo apt install ffmpeg
43+
```
44+
45+
To transmit system audio, start the sender with the following command:
46+
```bash
47+
ffmpeg -f pulse -i default \
48+
-acodec copy -f rtp \
49+
-fflags nobuffer -flags low_delay \
50+
-max_delay 0 -flush_packets 1 \
51+
-rtbufsize 0 -avioflags direct \
52+
-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 1 \
53+
rtp://192.168.1.1:5010
54+
```
55+
56+
- `192.168.1.1` is the IP address of the receiver → adjust accordingly!
57+
- `5010` is the port number → freely selectable, must match the receiver
58+
59+
### 📥 Receiver
60+
61+
Simply start the receiver:
62+
```bash
63+
./udp_audio_receiver
64+
```
65+
66+
A window will appear and automatically start playing audio when UDP packets are received.
67+
68+
---
69+
70+
## 🔊 If the audio is too quiet …
71+
72+
This may occur if the receiver volume is set too low.
73+
74+
### Possible solutions:
75+
- Use `alsamixer`, press `F6` to select the correct device, and increase volume
76+
- Or use the terminal:
77+
```bash
78+
amixer set 'Master' 100% unmute
79+
```
80+
81+
---
82+
83+
## 📁 Autostart
84+
85+
Create the file:
86+
```bash
87+
/home/pi/.config/autostart/UdpReceiver.desktop
88+
```
89+
90+
With the following content:
91+
```ini
92+
[Desktop Entry]
93+
Type=Application
94+
Exec=/path/to/program/udp_audio_receiver
95+
Hidden=false
96+
NoDisplay=false
97+
X-GNOME-Autostart-enabled=true
98+
Name=Udp_Receiver
99+
Comment=Automatically starts Udp_Receiver
100+
Name[de_DE]=Udp_Receiver.desktop
101+
```
102+
103+
Adjust path and filename accordingly.
104+
105+
---
106+
107+
## 📝 License
108+
109+
This project is licensed under the [MIT License](LICENSE).
110+
111+
---
112+
113+
**Author:** RaspberryPiFpcHub
114+
**GitHub:** https://github.com/RaspberryPiFpcHub
115+

udp_audio_receiver.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ip=0.0.0.0
2+
port=5010
3+
SizeNetworkbuffer=100000
4+
frequenz=48000
5+
swap=0
6+
alsalatency=28000

udp_audio_receiver.ctpr

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<CONFIG>
3+
<ProjectOptions>
4+
<Version Value="12"/>
5+
<General>
6+
<SessionStorage Value="InProjectDir"/>
7+
<Title Value="udp_audio_receiver"/>
8+
<Scaled Value="True"/>
9+
<ResourceType Value="res"/>
10+
<UseXPManifest Value="True"/>
11+
<XPManifest>
12+
<DpiAware Value="True"/>
13+
</XPManifest>
14+
<Icon Value="0"/>
15+
</General>
16+
<BuildModes>
17+
<Item Name="Default" Default="True"/>
18+
</BuildModes>
19+
<PublishOptions>
20+
<Version Value="2"/>
21+
<UseFileFilters Value="True"/>
22+
</PublishOptions>
23+
<RunParams>
24+
<FormatVersion Value="2"/>
25+
</RunParams>
26+
<RequiredPackages>
27+
<Item>
28+
<PackageName Value="adLCL"/>
29+
</Item>
30+
</RequiredPackages>
31+
<Units>
32+
<Unit>
33+
<Filename Value="udp_audio_receiver.ppr"/>
34+
<FRMtype Value="0"/>
35+
<IsPartOfProject Value="True"/>
36+
</Unit>
37+
<Unit>
38+
<Filename Value="../../Projekte/RTP_player/unit1.pas"/>
39+
<FRMtype Value="0"/>
40+
<IsPartOfProject Value="True"/>
41+
<ComponentName Value="Form1"/>
42+
<HasResources Value="True"/>
43+
<ResourceBaseClass Value="Form"/>
44+
</Unit>
45+
</Units>
46+
</ProjectOptions>
47+
<CompilerOptions>
48+
<Version Value="11"/>
49+
<Target>
50+
<Filename Value="udp_audio_receiver"/>
51+
</Target>
52+
<SearchPaths>
53+
<IncludeFiles Value="$(ProjOutDir)"/>
54+
<OtherUnitFiles Value="../../Projekte/RTP_player"/>
55+
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
56+
</SearchPaths>
57+
<Linking>
58+
<Options>
59+
<Win32>
60+
<GraphicApplication Value="True"/>
61+
</Win32>
62+
</Options>
63+
</Linking>
64+
</CompilerOptions>
65+
<Debugging>
66+
<Exceptions>
67+
<Item>
68+
<Name Value="EAbort"/>
69+
</Item>
70+
<Item>
71+
<Name Value="ECodetoolError"/>
72+
</Item>
73+
<Item>
74+
<Name Value="EFOpenError"/>
75+
</Item>
76+
</Exceptions>
77+
</Debugging>
78+
</CONFIG>

0 commit comments

Comments
 (0)