Broadcastify Raspberry Pi Feed Appliance Image v1.0 (BETA)

blantonl

Founder and CEO
Staff member
Super Moderator
Joined
Dec 9, 2000
Messages
11,095
Location
San Antonio, Whitefish, New Orleans
Ok, I've managed to get my Audio Injector Stereo sound card configured and working with my online feed; however, when I save and reboot, the settings go back to mono, 16, 1. It will work if I don't reboot it, but I'm concerned it will default back to mono if the power fails or something.

It will be nice to finally not keep my desktop running 24/7, so thanks for the image!

Am I missing something?
Thanks!
Can you advise what you mean by the "settings go back to mono" after a reboot?

The BCFY shell configuration utility always saves mono... so after you manually change it to "2" for stereo it should persist across reboots going forward.
 
Joined
May 5, 2021
Messages
2
I have spent a few hours trying to get my configuration set properly...but I'm having some trouble when I activate my stream with BCFY shell. I'm using RTL_Airband_NFM to send audio to Loopback1 which appears to be connecting properly when looking at the daemon log. However, when I open up the shell and start the stream, DarkIce is giving me this error:
Code:
Using config file: /home/pi/bcfy/configs/darkice/darkice_1.cfg
Using PulseAudio audio server as input device.
Using PulseAudio source: Loopback1.monitor
buffer size: 441000
encoding
using POSIX real-time scheduling, priority 4
DarkIce: PulseAudioDspSource.cpp:166 pa_simple_new() failed: %s
Connection refused [0]
Assertion 's' failed at pulse/simple.c:253, function pa_simple_free(). Aborting.
Aborted

Here is what the daemon log is showing:
Code:
Starting Darkice Instance 1 Service...
Started Darkice Instance 1 Service.
darkice_1.service: Main process exited, code=exited, status=134/n/a
darkice_1.service: Failed with result 'exit-code'

Here is the log at startup of RTL_Airband_NFM:
Code:
RTLSDR-Airband version 3.1.0 starting
pulse: <default_server>: connecting...
Device #0 gain set to 25.40 dB
RTLSDR device 0 initialized
pulse: <default_server>: stream "Dispatch" connected

I have tried to use RTL_Airband to stream directly with an icecast output but the audio quality seems sub-par and I keep hearing segments repeated on occasion, the stream seems to end up with a delay somewhere around 6 minutes or more.
 

scan18

Member
Premium Subscriber
Joined
Dec 23, 2004
Messages
289
Location
Honoka'a, HI
Sorry if this was answered already... if a new version of Trunk Recorder is released, does this include a script to update?
 

blantonl

Founder and CEO
Staff member
Super Moderator
Joined
Dec 9, 2000
Messages
11,095
Location
San Antonio, Whitefish, New Orleans
I have spent a few hours trying to get my configuration set properly...but I'm having some trouble when I activate my stream with BCFY shell. I'm using RTL_Airband_NFM to send audio to Loopback1 which appears to be connecting properly when looking at the daemon log. However, when I open up the shell and start the stream, DarkIce is giving me this error:
Code:
Using config file: /home/pi/bcfy/configs/darkice/darkice_1.cfg
Using PulseAudio audio server as input device.
Using PulseAudio source: Loopback1.monitor
buffer size: 441000
encoding
using POSIX real-time scheduling, priority 4
DarkIce: PulseAudioDspSource.cpp:166 pa_simple_new() failed: %s
Connection refused [0]
Assertion 's' failed at pulse/simple.c:253, function pa_simple_free(). Aborting.
Aborted

Here is what the daemon log is showing:
Code:
Starting Darkice Instance 1 Service...
Started Darkice Instance 1 Service.
darkice_1.service: Main process exited, code=exited, status=134/n/a
darkice_1.service: Failed with result 'exit-code'

Here is the log at startup of RTL_Airband_NFM:
Code:
RTLSDR-Airband version 3.1.0 starting
pulse: <default_server>: connecting...
Device #0 gain set to 25.40 dB
RTLSDR device 0 initialized
pulse: <default_server>: stream "Dispatch" connected

I have tried to use RTL_Airband to stream directly with an icecast output but the audio quality seems sub-par and I keep hearing segments repeated on occasion, the stream seems to end up with a delay somewhere around 6 minutes or more.
Try manually running darkice as the bcfy user instead of using the shell/scripts.
 
Joined
May 5, 2021
Messages
2
Ok, I have finally solved the issue that some (including myself) have been experiencing with PulseAudio not accepting connections. I initially had no trouble running things manually, then I tried to run with systemd unit files when I started having issues with permissions.

The key is to run your systemd units as a user service. PulseAudio really does not like running as root, or accepting anything dealing with the root user (they REALLY discourage it in the documentation...Whats is wrong with system mode?). Instead of creating your unit files in /etc/systemd/system, create them in /etc/systemd/user and activate them with the --user flag (see below: "Create systemd unit for RTLSDR-Airband", "Create systemd unit for Darkice", and "Final Steps" <-- very important).

As a newbie to radio (and mediocre with Linux), I'm not sure I fall into a "niche" category with my setup...but I figured I'd post a tutorial for anyone else who may fall into this category. Yes, I could have just configured RTLSDR-Airband to send audio directly to my stream with an Icecast output, I found the audio quality to be sub-par and lacked the filtering controls I wanted for cleaner audio.

Hardware: Raspberry Pi Model 4B, Nooelec NESDR SMArTee

Goal: Monitor/Broadcast a single (for now) NFM VHF frequency with a "hands-off" and headless setup.

Software: Ubuntu Server 21.04 (64bit), RTLSDR-Airband (v3.2.1), PulseAudio, DarkIce

Audio Flow: SDR --> RTLSDR-Airband (NFM) --> PulseAudio (Loopback) --> DarkIce (Loopback Monitor) --> Broadcastify


Why not Raspberry Pi Desktop or the BCFY Raspberry Pi Image? I couldn't get RTLSDR-Airband to gain access to the Raspberry Pi's GPU without running it as the root user on either of these OS images. The catch-22 here is that when running RTLSDR-Airband as root, it causes permission issues when trying to use a PulseAudio output...

There is likely a much simpler way to do this...but here we are.


Operating System Setup:

1. Use Raspberry Pi Imager or balenaEtcher to write Ubuntu Server to your SD Card

2. Boot up (the default username: ubuntu, password: ubuntu)

3. Get everything up-to-date by running: sudo apt-get update && sudo apt-get upgrade -y

Install RTLSDR-Airband (Documentation):


- Install dependencies: sudo apt-get install build-essential libmp3lame-dev libshout3-dev libconfig++-dev libfftw3-dev librtlsdr-dev libpulse-dev libasound2 libasound2-plugins alsa-utils alsa-oss pulseaudio-utils
- Download Code: cd --> wget -O RTLSDR-Airband-3.2.1.tar.gz https://github.com/szpajder/RTLSDR-Airband/archive/v3.2.1.tar.gz --> tar xvfz RTLSDR-Airband-3.2.1.tar.gz --> cd RTLSDR-Airband-3.2.1 ** Check HERE for the latest version, at the time of this post: v3.2.1 - change the version number in the commands above accordingly **
- Compile: make PLATFORM=armv8-generic NFM=1 PULSE=1
- Install: sudo make install
Configure RTLSDR-Airband according to your needs:
Here is a sample:
Code:
# /usr/local/etc/rtl_airband.conf

devices: ({
    type = "rtlsdr";
    index = 0;
    gain = 14;
    centerfreq = 151.070;
    correction = 0;
    
    channels: ({
        freq = 151.070;
        bandwidth = 11200;
        modulation = "nfm";
        notch = 192.8;
        
        outputs: ({
            type = "pulse";
            sink = "Loopback1";
            stream_name = "County Sheriff Dispatch";
            continuous = false;
        })
    })
})

Modify the permissions of your RTLSDR-Airband config file (we don't want to have to run as root as it causes issues when connecting to PulseAudio). sudo chmod 777 /usr/local/etc/rtl_airband.conf

Create systemd unit for RTLSDR-Airband:
sudo nano /etc/systemd/user/rtl_airband.service
* Take note of the WantedBy change, most unit files will have multi-user.target. For permissions and running this as a user service this should be default.target
Code:
# /etc/systemd/user/rtl_airband.service

[Unit]
Description=SDR AM/NFM demodulator
Documentation=https://github.com/szpajder/RTLSDR-Airband/wiki
Wants=network.target
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/rtl_airband -Fe
Restart=no

[Install]
WantedBy=default.target

Reload the systemctl user daemon systemctl --user daemon-reload --> enable the service systemctl --user enable rtl_airband.service

Configure PulseAudio:
sudo nano /etc/pulse/default.pa

Look for #load-module module-alsa-sink and remove the leading "#"


Then add the following to the bottom of the file:
Code:
load-module module-null-sink sink_name=Loopback1
update-sink-proplist Loopback1 device.description=Loopback1

load-module module-loopback sink=Loopback1
update-source-proplist Loopback1.monitor device.description=Loopback1-Monitor

load-module module-null-sink sink_name=Loopback2
update-sink-proplist Loopback2 device.description=Loopback2

load-module module-loopback sink=Loopback2
update-source-proplist Loopback2.monitor device.description=Loopback2-Monitor

Install & Configure Darkice:
Install: sudo apt-get install darkice

Configure: sudo nano /etc/darkice.cfg

Here is a sample config for a Broadcastify feed:
Code:
[general]

duration        = 0
bufferSecs      = 10
reconnect       = yes
realtime        = yes

[input]

device          = pulseaudio
paSourceName    = Loopback1.monitor
sampleRate      = 22050
bitsPerSample   = 16
channel         = 1

[icecast2-0]

bitrateMode     = cbr
format          = mp3
bitrate         = 16
quality         = 0.1
channel         = 1
lowpass         = 4000
sampleRate      = 22050

server          = audio#.broadcastify.com
port            = 80
password        = hackme
mountPoint      = mountpoint  # do not add leading /
name            = County Sheriff Dispatch

Create systemd user unit for Darkice:
sudo nano /etc/systemd/user/darkice.service
Code:
# /etc/systemd/user/darkice.service

[Unit]
Description=DarkIce live audio streamer
Documentation=http://www.darkice.org/ man:darkice(1) man:darkice.cfg(5)
Requires=sound.target
Wants=network-online.target
After=icecast.service network-online.target sound.target

[Service]
Type=simple
ExecStart=/usr/bin/darkice -c /etc/darkice.cfg

[Install]
WantedBy=default.target

Reload the systemctl user daemon systemctl --user daemon-reload --> enable the service systemctl --user enable darkice.service

Final Steps:
In order for our systemd user unit files to start at boot you should run the command: loginctl enable-linger which will allow the system to reboot and start your service units without actually having to login.

Reboot the system sudo reboot now

Once the system has started up, check RTLSDR-Airband and Darkice for any errors.
RTLSDR-Airband: systemctl --user status rtl_airband.service
Darkice: systemctl --user status darkice.service

Hopefully...you will see something like this:
Code:
ubuntu@ubuntu:/etc$ systemctl --user status rtl_airband.service
● rtl_airband.service - SDR AM/NFM demodulator
     Loaded: loaded (/etc/xdg/systemd/user/rtl_airband.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: https://github.com/szpajder/RTLSDR-Airband/wiki
   Main PID: 2284 (rtl_airband)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/rtl_airband.service
             └─2284 /usr/local/bin/rtl_airband -Fe

and this:
Code:
ubuntu@ubuntu:/etc$ systemctl --user status darkice.service
● darkice.service - DarkIce live audio streamer
     Loaded: loaded (/etc/xdg/systemd/user/darkice.service; enabled; vendor preset: enabled)
     Active: active (running)
       Docs: http://www.darkice.org/
             man:darkice(1)
             man:darkice.cfg(5)
   Main PID: 2274 (darkice)
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/darkice.service
             └─2274 /usr/bin/darkice -c /etc/darkice.cfg

ubuntu darkice[2274]: Using config file: /etc/darkice.cfg
ubuntu darkice[2274]: Using PulseAudio audio server as input device.
ubuntu darkice[2274]: Using PulseAudio source:  Loopback1.monitor
ubuntu darkice[2274]: Using POSIX real-time scheduling, priority 4

POSIX Real-Time Scheduling:
If your Darkice service throws an error saying it cannot proceed with POSIX scheduling, you'll need to do one more step to avoid skipping and repeats in your stream.

Edit the following file: sudo nano /etc/security/limits.conf

Add the following before "# End of file":
Code:
@audio           -       rtprio          95
@audio           -       memlock         unlimited

Ensure the default ubuntu user is part of the audio group:
sudo su
usermod -a -G audio ubuntu

Yes this is quite the process...thankfully the system has stayed solid through reboots so far.

Hopefully this will take down a barrier for someone else getting their stream online!
 

cobraultra

Member
Feed Provider
Joined
Feb 2, 2010
Messages
65
Location
Pittsburgh, PA
Sorry if this was already asked... I tried skimming the thread....
Just installed the lasted image yesterday... but every time I issue a reboot command it never come back up...
Anyone else seen this yet? I have to power cycle the pi.
 

WD0JB

Member
Feed Provider
Joined
Sep 30, 2019
Messages
5
Using broadcastify pi image, and the config.json has the entry:

"audioArchvie": "false"

however the audio files are not being deleted after upload (filling up my sd card pretty quickly). Am I missing something here?
 

KB9LMJ

Member
Joined
Sep 8, 2003
Messages
322
Can you advise what you mean by the "settings go back to mono" after a reboot?

The BCFY shell configuration utility always saves mono... so after you manually change it to "2" for stereo it should persist across reboots going forward.
In my:
cd /home/pi/bcfy/configs/darkice
sudo nano darkice_1.cfg

The first time I got it working, I changed the bitsPerSample from 16 to 32, and the channel to 2, as pictured below. It worked the first time, but every time I rebooted the Pi, despite doing an ^X with a Y for Save, it would default to 16, 1.

Well, for some reason, my Pi crashed today and I had to reconfigure my stream and I lost my stereo input, it started combining the L and R back into one stream. I reconfigured everything and did the command above, but this time it isn't changing to stereo, it is combining my L and R into one stream even though I am changing 1 to 2 and 16 to 32, as pictured.
I'm not sure what is going on...:(
 

Attachments

  • 20210519_194504-min.jpg
    20210519_194504-min.jpg
    64 KB · Views: 15
Last edited:

benjamingslade

Newbie
Premium Subscriber
Joined
Sep 1, 2020
Messages
4
Location
Kensington, MD
So I ordered the exact raspberry pie and sound card per instructions. I set it up and configured it with ease, it went very smoothly. However, my feed hasn't been stable since. It randomly goes down every couple of days for no reason. So tonight I pulled the card and started from scratch, reinstalled the image, updated, reconfigured, etc. This is my last attempt, wish me luck. If the problem continues, I will go back to running ScannerCast on my PC. I will keep you updated.

I've been looking at a sporadic/irregular hiccup that takes my feed down too. Possibly network hiccup related. See:

Feed down after network hiccup. Monitor and auto-restart? (another thread in this forum)

I'm thinking about running a shell script which checks the status of the feed on Broadcastify.com and restarts the darkice service/instance if Broadcastify thinks it's down (or maybe just restart the whole Raspberry Pi box)
 

tiapass00

Member
Joined
Feb 22, 2021
Messages
18
I'm hoping someone can get me pointed in the right direction. I've set up this new image and have my feed running without issue, but am trying to add in Two Tone Detect, and cannot get it up and running. I believe the issue is somewhere in my audio settings because TTD isn't detecting any audio, but I don't know where it needs to be fixed. (I have TTD running on other pi's without a problem.)
 

RaleighGuy

Member
Premium Subscriber
Joined
Jul 15, 2014
Messages
13,128
Location
Raleigh, NC
Had a power outage due to lightening nearby, after power came back up a few seconds later I'm now unable to start my Darkice feed configuration. Tried stopping/starting, tried rebooting, tried wifi on, tried network cable, tried reconfiguring, still nothing. Message I'm getting is:
------------------------------------------------
[1] Darkice - Raleigh Durham Airport Public Safety and Public Works
------------------------------------------------
Choose one of the following actions:

[1] Start
[2] Stop
[3] Restart
[4] Enable start on boot
[5] Disable start on boot

[q] Quit

Enter action: 1
Starting darkice_1...
\u25cf darkice_1.service - Darkice Instance 1 Service
Loaded: loaded (/etc/systemd/system/darkice_1.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2021-05-26 18:18:53 EDT; 1s ago
Process: 1349 ExecStartPre=/bin/sleep 10 (code=exited, status=0/SUCCESS)
Process: 1525 ExecStart=/usr/bin/sh -c /usr/local/bin/darkice -v5 -c /home/pi/bcfy/configs/darkice/darkice_1.cfg > /home/pi/bcfy/logs/darkice_1.log 2>&1 (code=exited, status=255/EXCEPTION)
Main PID: 1525 (code=exited, status=255/EXCEPTION)
Press [Enter] to return to the main menu...

It is showing this on the status screen:
------------------------------------
>>> Configured Darkice Instances <<<
----------------------------------------------------------------------------
Item Status Config Instance
Boot
----------------------------------------------------------------------------
[1] activating (auto-restart) Configured 1-Raleigh Durham Airport Public Safety and Public Works
enabled

Any suggestions to get it running again?
 
Last edited:

DC31

Member
Feed Provider
Joined
Feb 19, 2011
Messages
1,545
Location
Massachusetts
I'm hoping someone can get me pointed in the right direction. I've set up this new image and have my feed running without issue, but am trying to add in Two Tone Detect, and cannot get it up and running. I believe the issue is somewhere in my audio settings because TTD isn't detecting any audio, but I don't know where it needs to be fixed. (I have TTD running on other pi's without a problem.)
From previously:

TTD requires pulseaudio to work.
 

RaleighGuy

Member
Premium Subscriber
Joined
Jul 15, 2014
Messages
13,128
Location
Raleigh, NC
Had a power outage due to lightening nearby, after power came back up a few seconds later I'm now unable to start my Darkice feed configuration. Tried stopping/starting, tried rebooting, tried wifi on, tried network cable, tried reconfiguring, still nothing.

Any suggestions to get it running again?

Restarted it again and it is now working, guess it just needed a rest.
 

blantonl

Founder and CEO
Staff member
Super Moderator
Joined
Dec 9, 2000
Messages
11,095
Location
San Antonio, Whitefish, New Orleans
I'm hoping someone can get me pointed in the right direction. I've set up this new image and have my feed running without issue, but am trying to add in Two Tone Detect, and cannot get it up and running. I believe the issue is somewhere in my audio settings because TTD isn't detecting any audio, but I don't know where it needs to be fixed. (I have TTD running on other pi's without a problem.)
The image is not designed to host anything other that what is specifically documented, and I’m not in a situation right now to support anything else other than what is bundled with the image.
 

freema22

Member
Feed Provider
Joined
Sep 22, 2003
Messages
175
Location
Michigan
So, with the image, can I use my SDR to supply an analog feed? I started messing with it last night, and wasn't quite understanding the ins and outs. My regular feed broke over the weekend, and I just happened to come across this thread and thought I'd give it a shot. Thanks!
 
Top