Header Image - Kilo Charlie 4 Romeo Charlie Romeo

Monthly Archives

2 Articles

Streaming Audio Using Darkice

It is easy to use a Raspberry Pi to stream audio to your own webserver (running on the RPi) or using a global site such as Broadcastify. Though I used a RPi to build this, it is not unique to the RPi and can run on a variety of systems (I have used the same setup on my Ubuntu laptop).

Here’s what you will need:

  • Raspberry Pi (any will work but I use a RPi4 with 4GB RAM)
  • USB Audio Dongle
  • Speaker to Line Audio Converter (build or buy)
  • Scanner (or other radio output device)
  • Assorted audio connectors and cables
  • An Internet connection of course

Assumptions:

  • You have a working knowledge of installing the Raspberry Pi Operating System and can access it on your network or directly from a console setup
  • Your scanner or radio receiving device works and has an antenna and can receive the frequency or range you wish to broadcast
  • You are able to open a port for port forwarding on your Internet router to the port running Icecast (if you want to open the server to the world)

First, get your Raspberry Pi set up however you like with the Raspberry Pi Operating System according to the instructions found here (or using your own method). The instructions here should work for pretty much any modern Debian-based Linux distribution.

Now for the hardware setup. Your scanner or radio’s audio needs to be taken down from speaker level to line level. They do make converters you can buy such as these on Google. But you can also build one. I used this design found here with two 3.5mm jacks for the connections:

Speaker to Line Level Converter from https://www.epanorama.net/circuits/speaker_to_line.html

One note on this, it assumes your scanner is mono so no reason to use a stereo 3.5mm plug. Here’s my built version on the above diagram:

Speaker to Line Converter (using Mono to Stereo Connectors)

On an older version I had a commercial converter shows in this picture:

The SNI-35 Line Output Converter

Now let’s put it all together with the USB Audio device inserted into the RPi and the microphone jack running through the speaker to line converter to the speaker out jack of the scanner. By the way, this setup is in my laundry room because it is opposite the ham antenna side. There will still be some de-sensing on transmit especially with these older scanners. There is an external discone antenna it is connected to (see BC760XLT Scanner Repair for the background story).

RPi with USB Audio Device
Scanner Connected to RPi Audio

Now we move on to the software side of things. Boot up your RPi and once you have the system up and running how you like it, install Darkice via the command:

sudo apt-get install darkice

You will need to create/modify the Darkice configuration file. The default location is in /etc but you can specify an alternate location when you run the darkice command to start your streaming.

There is a great darkice.cfg example at the following link which is the one I used as my starting point on the Raspberry Pi:

https://wiki.radioreference.com/index.php/Live_Audio/Ubuntu_Darkice

You will need to sign up for a Broadcastify feed provider account and get the “mountpoint” and “password” from your account page and input it in the configuration file. Also note you may have to change the configuration slightly depending on your hardware. I had to change the “device” setting to “hw:2,0” and “sampleRate” to “44100” based on my configuration. You can view your hardware location via the “aplay -l” command. NOTE! When I rebooted headless (no monitor) the HDMI connection changed the hardware ports, so be aware this might happen.

Similar to the issue described on the page linked above, Darkice does not reliably restart on reboot. I’ve tried various configurations, running it as root, etc. and nothing has proven effective. If I find a solution I will post it.

Darkice should be run as a normal user, not root. The reason for the comment here is that when you run it as a normal user it will tell you try running as root, that is not needed.

If all is well, run darkice from the command prompt and your feed will show active over at Broadcastify! As I said before, you might have to fiddle around with the sample rate or other settings to get it just right for your configuration. For reference, here is how I start my Darkice instance:

nohup darkice -c /home/pi/darkice.cfg &

The “nohup” signifies No Hangup which leaves the process running after I log out. The “-c” specifies the configuration file and the “&” means run as a daemon/background process. Since I run headless, I ssh into my RPi and start darkice this way from my remote terminal.

BREAK BREAK BREAK… Okay you are done if all you wanted is a Broadcastify feed. But some have asked how you would host streaming audio on your own. the following section describes the additional steps which will be needed to do this.

If you want to run your own server you can install Icecast2. Darkice will feed to Icecast. Install Icecast using apt:

sudo apt-get install icecast2

Icecast will install in /etc/icecast2 and run the auto configure program for you. Be sure to remember your passwords as you will need the source password in the darkice.cfg file. The port you choose to run on (default 8000) is the one you will point your browser to on the RPi IP address. You can always edit the icecast.xml configuration file found in the installed directory mentioned above. Another good install document can be found here. Once you have finished the configuration, run:

sudo systemctl start icecast2

You can always replace “start” with “restart” or “stop”. You can also enable it to always run on reboot with “enable” (or do the opposite with “disable”). Once running you can point your browser to http://yourRPiaddress:port where that is the RPi’s IP and port number you chose in the setup. If you are local, you could use http://127.0.0.1:8000, for example. You should see this:

Icecast2 with no Streams

If that page came up, great news you are almost there. The next step is to feed Darkice into Icecast. You do that by adding an Icecast section to the darkice.cfg file using the password you set up in the Icecast installation for sources. If your darkice.cfg has an “[icecast2-1]” section already you can edit it, otherwise add the following, tailored for your installation:

[icecast2-1]
bitrateMode = abr # average bit rate
format = vorbis # format of the stream: ogg vorbis
bitrate = 96 # bitrate of the stream sent to the server
server = 127.0.0.1
port = 8000 # port of the IceCast2 server, usually 8000
password = SOURCEPWD # source password to the IceCast2 server
mountPoint = KC4RCR # mount point of this stream on the IceCast2 server
name = DarkIce
description = KC4RCR Scanner Traffic
url = http://www.kc4rcr.com
genre = Mostly 2 meter ham repeaters around the VA area
public = no # advertise this stream?

Now restart the service using sudo systemctl restart icecast2 if applicable and go back to your web browser and reload the Icecast page. You should see something similar to the following:

Icecast Streaming

You can also login via your admin password (username admin) and see the stream stats and listener info. It is just one mount point here so that’s all that is displayed. Icecast supports a variety of configurations if you are interested. Visit icecast.org for more information.

Index: 20

AM Broadcast Rejection Filter Testing

by admin 0 Comments

I have a 270 foot off-center fed dipole which works pretty well for my 160m and other band needs (with an external tuner). My HF rig is a Yaesu FT-450D which appears to have a great front end to suppress unwanted signals. Occasionally I like to look at the spectrum in Gqrx with my RTL-SDR dongle. But take a look at the image below!

That’s a lot of annoying interference

The RTL-SDR does very little to clear this up, but given the reasonable price and utility of the device, it is not unexpected.

I have the RTL2832U model SDR which works on HF

I have a number of very strong AM broadcast stations nearby so I thought I would give a couple filters a go at it. First, I tested with a cheap RTL-SDR brand “Broadcast AM Reject Filter” which attenuates below 2.6MHz.

RTL-SDR Broadcast AM Reject Filter

Now let’s take a look at the Gqrx spectrum waterfall

40 meters in Gqrx with SDR filter

That’s a great amount of cleanup! Now I know my FT-450D does a better job than the SDR dongle, but I figured I would check out a legitimate filter which can be used with a transmitter. I found the M-402x by Morgan Systems which attenuates below 1.8MHz and can tolerate 200 watts of power (they have another version if you don’t use 160m). I ordered this from KF7P Metalwerks which came quickly and excellently packaged.

M-402x Filter

Now let’s take a look at this filter in the Gqrx spectrum waterfall like we did with the other. Obviously my attenuation is a little bit less because I wanted to use 160m which is close to the AM broadcast band. Also, these pictures were taken at night when the signal was hitting me the hardest (in the day it looked even better).

Gqrx with the M-402x

I am very happy with the results and the M-402x is now installed with the FT-450D and I am currently listening to a great signal on 1.900MHz!

Index: 4
PHP Code Snippets Powered By : XYZScripts.com