Add streaming audio to OP25 RPi scanner

Thanks to Graham Norbury, here is how to set up a Raspberry Pi OP25 scanner to stream audio to an icecast or other streaming server. I have updated my plug-and-play op25-rpi.img image at to include this capability (look for the or later-dated file).

1. Copy the following into a new file /etc/asound.conf on the Raspberry Pi (you’ll need to do this as root):

# output device
pcm.loopout {
type dmix
ipc_key 328211
slave.pcm "hw:Loopback,0,0"

# input device
pcm.loopin {
type dsnoop
ipc_key 686592
slave.pcm "hw:Loopback,1,0"

# duplex plug device
pcm.loop {
type plug
slave {
pcm {
type asym
playback.pcm "loopout"
capture.pcm "loopin"

pcm.mout {
type plug
slave.pcm mdev
route_policy "duplicate"

pcm.mdev {
type multi

slaves.a.pcm "hw:Loopback,0,0"
slaves.a.channels 2
slaves.b.pcm "hw:0,0"
slaves.b.channels 2

bindings.0.slave a 0
bindings.1.slave a 1
bindings.2.slave b 0
bindings.3.slave b 1

2. Copy the following into a new file /etc/modprobe.d/alsa-loop.conf on the Raspberry Pi (again, as root):

softdep snd-bcm2835 post: snd-aloop

3. Add “-O mout” to the command line.

4. Install darkice on the Raspberry Pi:

sudo apt-get install darkice

5. Copy the following into a new file /etc/darkice.cfg on the Raspberry Pi (once again, as root), and replacing the password, server name, etc. with your local info:

# sample DarkIce configuration file, edit for your needs before using
# see the darkice.cfg man page for details

# this section describes general aspects of the live streaming session
duration = 0 # duration of encoding, in seconds. 0 means forever
bufferSecs = 5 # size of internal slip buffer, in seconds
reconnect = yes # reconnect to the server(s) if disconnected
realtime = yes # run the encoder with POSIX realtime priority
rtprio = 3 # scheduling priority for the realtime threads

# this section describes the audio input that will be streamed
device = loop # OSS DSP soundcard device for the audio input
sampleRate = 11025 # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # bits per sample. try 16
channel = 1 # channels. 1 = mono, 2 = stereo

# this section describes a streaming connection to an IceCast2 server
# there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7]
# these can be mixed with [icecast-x] and [shoutcast-x] sections
bitrateMode = abr # average bit rate
format = vorbis # format of the stream: ogg vorbis
bitrate = 96 # bitrate of the stream sent to the server
# host name of the server
port = 8000 # port of the IceCast2 server, usually 8000
password = MY_ICECAST_PASSWORD # source password to the IceCast2 server
mountPoint = op25.ogg # mount point of this stream on the IceCast2 server
name = OP25 Scanner
# name of the stream
description = OP 25 Scanner listening to MY_SYSTEM
# description of the stream
url =
# URL related to the stream
genre = Public Safety # genre of the stream
public = yes # advertise this stream?
localDumpFile = dump.ogg # local dump file

6. Note that this version of darkice does *not* support mp3 format; to get that you will need to compile from source, and I’m not going to go into that here.

7. Darkice can stream to an external site like Broadcastify though I am using mine to stream to a local Icecast server for consumption on my local network.

4 thoughts on “Add streaming audio to OP25 RPi scanner

  1. Hi John,

    I’ve found your RPI Scanner posts really useful, thank you!

    I want to subscribe to your blog but your RSS feed seems to be broken – just wanted to let you know.

    1. Hi —

      Thanks for the kind words. I don’t post very often and never got around to setting up an RSS feed. I’ll look into doing that.


  2. Hi John,

    I`m trying to use your prebuilt image to track a DMR system
    Color 12
    Slot 1

    Is it possible with your build?

    1. Sorry, I can’t help you as this code is configured for a P.25 trunking system, not standalone DMR (which I’ve never actually played with).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.


PowerPole Color Conventions

A lot of us use Anderson PowerPole connectors for DC power distribution. There's a nearly universal standard to use red…

Peak vs. Average Power in Complex Waveforms (and Gnuradio)

One of my Gnuradio projects is a tool that records IQ data covering 375 kHz -- which is enough to…

Anan7000/HPSDR and Icom IC-7300 S-Meter Calibration

I've noticed that my SDR setup, an Apache Labs Anan-7000DLE transceiver used with the PowerSDR software, seems to rest the…

Thoughts on a Wideband SDR Recording Tool

As part of the HamSci Solar Eclipse experiment, I recorded wideband data from my SDRs on the theory that capturing…