Golang streamer for sdr_fm/sdr_rtl devices
spsobole 6575b91b2e Merge changes from contrib | 3 years ago | |
---|---|---|
api | 3 years ago | |
cmd | 3 years ago | |
config | 3 years ago | |
plex | 3 years ago | |
streamer | 3 years ago | |
README.md | 3 years ago | |
build.yaml | 3 years ago | |
file.go | 3 years ago | |
go.mod | 3 years ago | |
radio.go | 3 years ago | |
rtlfm.go | 3 years ago | |
rxfm.go | 3 years ago | |
wav.go | 3 years ago |
Tool to stream sdr_fm audio over HTTP written in golang.
You need a to install a copy of sdr_fm
sudo apt-get install rtl-sdr
You may need to unload kernel modules and black list the modules:
#lists modules using the rtl driver
lsmod |grep rtl
#remove them
rmmod dvb_usb_rtl28xxu
rmmod videodev
rmmod rtl2832_sdr
#optionally black list for the next reboot
echo "blacklist dvb_usb_rtl28xxu" >> /etc/modprobe.d/blacklist.conf
go build git.thirdmartini.com/pub/go-sdr-stream/cmd/service
if you want to crosscompile for Raspberry Pi
GOOS=linux GOARCH=arm go build git.thirdmartini.com/pub/go-sdr-stream/cmd/service
Use:
GOARCH=arm64 for RPI4 when running a 64bit os
See config/config.yaml for an example
Services:
- Name: "Stream 0"
Description: "FM Radio Stream"
MaxClients: 16 <-- Max Clients you want to allow to stream at the same time
ClientTimeoutSec: 30 <-- Timeout when a client goes idel
AllowTune: true <-- allow tuning interface
Tuner: <-- Tuner driver config
Type: sdr-fm <-- sdr-fm (uses rtl_fm )
Id: 0 <-- device id.. if you have multiple devices
SampleRate: 192000 <-- radio sampling rate
DownSampleRate: 48000 <-- output rate
Gain: 50 <-- sdr gain
Oversample: 1 <-- rtl oversampling
Presets: <--Preset channels (Supports any number of cahnnels)
- Name: 93.3 KTCL <-- Chanel name dfor display
Description: Alternative Rock <-- short channel description
Channel: 93.3 FM <-- the channel frequency
- Name: 95.5 KTLA
Description: Classical;
Channel: 95.6 FM
./service --config=<myconfig.yml>
You can now go to the ip address of where tou are running service with a web browser:
http://<myip>:9090/
You will have a stream for every service available at:
http://<myip>:9090/<service>/stream
IE:
http://<myip>:9090/0/stream