Op25 and Liquidsoap on bookworm

danielw97

Member
Joined
Mar 27, 2016
Messages
16
Hi folks,
I see a few topics regarding Op25 and bookworm, although this issue is a strange one so figured I would create my own topic.
I'm currently trying to run Boatbod's fork of Op25 on a debian headless machine, and stream over my local network with liquidsoap and icecast.
I've got everything setup with mountpoints etc in icecast, although when running my appropriately modified op25.liq I get the following error from liquidsoap:
At ./op25.liq, line 56, char 215-226:
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="op2
5", genre="Public Safety", url="", fallible=false, icy_metadata="true", host="lo
calhost", port=8000, mount="op25", password="mypassword", mean(input))

Error 5: this value has type
source(audio=pcm(mono),...)
but it should be a subtype of
source(audio=pcm(stereo),...)
Has anyone come across this and knows if there is a solution?
Annoyingly I remember encountering this a year back and believe I fixed it back then, but can't recall what I ended up doing.
Thanks in advance for any help with this.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,392
Location
Talbot Co, MD
Hi folks,
I see a few topics regarding Op25 and bookworm, although this issue is a strange one so figured I would create my own topic.
I'm currently trying to run Boatbod's fork of Op25 on a debian headless machine, and stream over my local network with liquidsoap and icecast.
I've got everything setup with mountpoints etc in icecast, although when running my appropriately modified op25.liq I get the following error from liquidsoap:
At ./op25.liq, line 56, char 215-226:
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="op2
5", genre="Public Safety", url="", fallible=false, icy_metadata="true", host="lo
calhost", port=8000, mount="op25", password="mypassword", mean(input))

Error 5: this value has type
source(audio=pcm(mono),...)
but it should be a subtype of
source(audio=pcm(stereo),...)
Has anyone come across this and knows if there is a solution?
Annoyingly I remember encountering this a year back and believe I fixed it back then, but can't recall what I ended up doing.
Thanks in advance for any help with this.
Maybe try changing "stereo=false" to "stereo=true"?
 

danielw97

Member
Joined
Mar 27, 2016
Messages
16
Hi Boatbod,
Thanks for your speedy reply.
I've just tried changing it to stereo=true, and I still get the exact same error unfortunately.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
982
Location
NE Wisconsin
Liquidsoap errors out with a segmentation fault when executed on Raspbian Bookworm unless you downgrade the ffmpeg suite.
What hardware platform are you using and with what specific Bookworm OS?

Can you post your op25.liq and either rx.py command line, or multi_rx.py json files with password(s) redacted?
 
Last edited:

danielw97

Member
Joined
Mar 27, 2016
Messages
16
Hi,
Thanks for the replies and info.
I'm currently running an amd64 distribution of Debian Bookworm as apposed to raspbian alongside liquidsoap 2.1.3.
My current rx.py commandline lookslike this:
./rx.py --args 'rtl' -S 1000000 -n --gains 'lna:36' -T halton2.tsv -2 -l http:0.0.0.0:8080 -V -w -M my-meta.json 2> stderr.2 -X
and my op25.liq, sorry for the wall of text:

#!/usr/bin/liquidsoap

# Example liquidsoap streaming from op25 to icecast
# (c) 2019-2021 gnorbury@bondcar.com, wllmbecks@gmail.com
#

set("log.stdout", true)
set("log.file", false)
set("log.level", 1)

# Make the native sample rate compatible with op25
set("frame.audio.samplerate", 8000)

input = mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 1.5 -s"))
# Consider increasing the buffer value on slow systems such as RPi3. e.g. buffer=0.25
# Longer buffer results in less choppy audio but at the expense of increased latency.



# OPTIONAL AUDIO SIGNAL PROCESSING BLOCKS
# Uncomment to enable
#
# High pass filter
#input = filter.iir.butterworth.high(frequency = 200.0, order = 4, input)

# Low pass filter
#input = filter.iir.butterworth.low(frequency = 3250.0, order = 4, input)

# Compression
input = compress(input, attack = 2.0, gain = 0.0, knee = 13.0, ratio = 2.0, release = 12.3, threshold = -18.0)

# Normalization
input = normalize(input, gain_max = 6.0, gain_min = -6.0, target = -16.0, threshold = -65.0)



# LOCAL AUDIO OUTPUT
# Uncomment the appropriate line below to enable local sound
#
# Default audio subsystem
out (input)
#
# PulseAudio
output.pulseaudio(input)
#
# ALSA
#output.alsa(input)



# ICECAST STREAMING
# Uncomment to enable output to an icecast server
# Change the "host", "password", and "mount" strings appropriately first!
# For metadata to work properly, the host address given here MUST MATCH the address in op25's meta.json file
#
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=true), description="op25", genre="Public Safety", url="", fallible=false, icy_metadata="true", host="localhost", port=8000, mount="op25", password="password", mean(input))
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
982
Location
NE Wisconsin
It's possible the input source format has changed in Liquidsoap V2.1.3 and my require some changes from the example op25.liq.
Below is an op25.liq file that works with Liquidsoap V2.0.2 that you could try. It this doesn’t work, report back and I will spin up a
VM with the identical amd64 disto of Debian Bookwork to explore what has changed in Liquidsoap V2.1.3.

op25.liq (Liquidsoap V2.0.2)


#!/usr/bin/liquidsoap

# Example liquidsoap v2.x streaming from op25 to icecast
# (c) 2019-2023 gnorbury@bondcar.com, wllmbecks@gmail.com
#

settings.log.stdout.set(true)
settings.log.file.set(true)
settings.log.file.path.set("/home/username/op25/op25/gr-op25_repeater/apps/liquidsoap.log")
settings.log.level.set(3)
settings.log.file.append.set(false)


# Make the native sample rate compatible with op25
settings.frame.audio.size.set(8000)

input = mksafe(input.external.rawaudio(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 1.25 -s"))
# Consider increasing the buffer value on slow systems such as RPi3. e.g. buffer=0.25
# Longer buffer results in less choppy audio but at the expense of increased latency.



# OPTIONAL AUDIO SIGNAL PROCESSING BLOCKS
# Uncomment to enable
#
# High pass filter
#input = filter.iir.butterworth.high(frequency = 200.0, order = 4, input)

# Low pass filter
#input = filter.iir.butterworth.low(frequency = 3250.0, order = 4, input)

# Compression
input = compress(input, attack = 15.0, gain = 2.0, knee = 1.0, ratio = 3.0, release = 60.0, threshold = -24.0)

# Normalization
input = normalize(input, gain_max = 6.0, gain_min = -6.0, target = -16.0, threshold = -40.0)


# LOCAL AUDIO OUTPUT
# Uncomment the appropriate line below to enable local sound
#
# Default audio subsystem
#out (input)
#
# PulseAudio
#output.pulseaudio(input)
#
# ALSA
#output.alsa(input)

# ICECAST STREAMING
# Uncomment to enable output to an icecast server
# Change the "host", "password", and "mount" strings appropriately first!
# For metadata to work properly, the host address given here MUST MATCH the address in op25's meta.json file
#
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="OP25", genre="Public Safety",
url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="op25", password="password", mean(input))
 

danielw97

Member
Joined
Mar 27, 2016
Messages
16
Hi,
Thanks for your op25.liq file, unfortunately even with that file in place I'm still getting the same error.
At ./op25.liq, line 57, char 109-120:
url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount
="op25", password="password", mean(input))

Error 5: this value has type
source(audio=pcm(mono),...)
but it should be a subtype of
source(audio=pcm(stereo),...)
I assume this is an issue with liquidsoap, and not my icecast setup etc, as it seems to fail at an early stage.
Thanks again for your help with this, and if there's any more info I can provide do let me know.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
982
Location
NE Wisconsin
OK. I will setup an amd64 Debian Bookworm VM tomorrow and take a look. In the meantime, try adding the audio_to_stereo()
operator following your input = mksafe(input.external) line. See the excerpt below.

input = mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -x 1.5 -s"))
# Consider increasing the buffer value on slow systems such as RPi3. e.g. buffer=0.25
# Longer buffer results in less choppy audio but at the expense of increased latency.

input = audio_to_stereo(input)

Bill
 
Last edited:

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
982
Location
NE Wisconsin
Well, I built a Debian 12.4.0 (Bookworm) VM and installed Liquidsoap Version 2.1.3 for a test drive. I was able to duplicate the same
error you reported, but I was able to get the source (input) line working. (See below)

input = mksafe(input.external.rawaudio(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, source(audio=pcm(mono),"./audio.py -x 1.25 -s"))

However, once source was fixed, everything else that worked from my V2.0.2 LIQ is now broken. I had to complete comment
out the audio processing blocks and found that the local audio options are broken as is the output.icecast operator. These now
all result in parse errors that will require searching the Liquidsoap 2.1.3 reference documentation to determine what else has now
changed with this release.

I would suggest locating the Liquidsoap 2.1.3 Reference to try and figure out all of the scripting changes if you are set on sticking
with Debian Bookworm. Otherwise, Liquidsoap, Boatbod op25 and Osmocom op25 all build and execute without errors
on Ubuntu Desktop 18.04.6, 20.04.6, and 22.04.3 distros.
 

danielw97

Member
Joined
Mar 27, 2016
Messages
16
Okay, thanks very much for your help on this and confirming that what I'm seeing is reproducible.
I should be able to build a previous version of liquidsoap from source, is there a preferred working version to stick with?
Failing that I'll move over to Ubuntu 22.04.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
982
Location
NE Wisconsin
Okay, thanks very much for your help on this and confirming that what I'm seeing is reproducible.
I should be able to build a previous version of liquidsoap from source, is there a preferred working version to stick with?
Failing that I'll move over to Ubuntu 22.04. Ubuntu 22.04.3

I would suggest Ubuntu 22.04.3 LTS that apt installs Liquidsoap 2.0.2 and you can use the op25.liq script in Post #6 as a working template.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
982
Location
NE Wisconsin
It's very frustrating that liquidsoap changes their api so frequently. Thanks for digging down into this issue Bill!

Liquidsoap on Raspbian Bookworm is totally borked and it doesn't appear the folks at Raspberrypi.org or Savonet are much interested
in fixing it, and AFAIK, owners of the new RPi-5 SBCs are forced to use Bookworm. This is just another reason that I have personally moved away from using their SBC's having migrated to using SFF PC's imaged with Ubuntu.
 

n8zuz

Member
Joined
Jul 17, 2004
Messages
61
Location
Windy WY
I just redid my OP25 computer with Linux Mint Debian Edition (based on Debian 12 Bookworm) and am getting an error as well. Liquidsoap v2.1.3-2

I'll try LinuxMint Ubuntu version again. I was on 20.2 and upgraded to 21.3 and janked it up. I'll try again.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
982
Location
NE Wisconsin
I just redid my OP25 computer with Linux Mint Debian Edition (based on Debian 12 Bookworm) and am getting an error as well. Liquidsoap v2.1.3-2

I'll try LinuxMint Ubuntu version again. I was on 20.2 and upgraded to 21.3 and janked it up. I'll try again.
Ubuntu 22.04.3 and Linux Mint 21.3 are excellent choices. Their repositories build Liquidsoap 2.0.2 that also works fine with the example
LIQ shown in Post #6 that can serve as a template.
 

jegallag

Member
Feed Provider
Joined
Feb 27, 2005
Messages
24
Location
Bel Air, MD
I am running bookworm on an AMD device and startup is failing due to the following:
Using Python /usr/bin/python3
CPU Features: SSE2+ SSE4.1+ AVX+ FMA+
Using avx for xtrxdsp_iq16_sc32
Using avx for xtrxdsp_iq8_ic16
Using avx for xtrxdsp_iq16_ic16i
Using avx for xtrxdsp_iq8_ic8i
Using avx for xtrxdsp_sc32i_iq16
Using avx for xtrxdsp_iq8_sc32
Using avx for xtrxdsp_iq8_sc32i
Using avx for xtrxdsp_iq16_sc32i
Using avx for xtrxdsp_sc32_iq16
Using avx for xtrxdsp_ic16i_iq16
gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.10.5.1
built-in source types: file fcd rtl rtl_tcp uhd hackrf bladerf rfspace airspy airspyhf soapy redpitaya freesrp xtrx
Using device #0 Generic RTL2832U OEM
usb_open error -3
Please fix the device permissions, e.g. by installing the udev rules file rtl-sdr.rules
osmosdr source_c creation failure
Traceback (most recent call last):
File "/home/johng/op25/op25/gr-op25_repeater/apps/./rx.py", line 1101, in <module>
rx = rx_main()
^^^^^^^^^
File "/home/johng/op25/op25/gr-op25_repeater/apps/./rx.py", line 1005, in __init__
self.tb = p25_rx_block(self.options)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/johng/op25/op25/gr-op25_repeater/apps/./rx.py", line 169, in __init__
gain_names = self.src.get_gain_names()
^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_gain_names'


If I run the command as root, it works fine. How do I get this to run properly at statup.
Thanks,
John G.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,392
Location
Talbot Co, MD
Did you install the blacklist-rtl.conf udev rules file under /etc/modprobe.d/ and did you reboot the machine?
Can you see the USB device using "lsusb" and/or "dmesg"?
 
Top