OP25 Raspberry Pi-4 Buster and Liquidsoap issue

Status
Not open for further replies.

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
I have been unable to happily install Liquidsoap on a Raspberry Pi-4 with Buster along with op25 and pulsaudio. Two instances of op25 are running as expected with audio output to speaker jack. The problem is when I installed liquidsoap using this command:
sudo apt-get install liquidsoap liquidsoap-plugin-all
it forces me to use:
sudo apt-get install liquidsoap
(I do have a log of that loading process.)
I did notice that the liquidsoap folder in /usr/share/liquidsoap is empty.

When I run./op25.liq I do not get the results as described by boatbod ... OP25 - Experiments with op25 and liquidsoap
(and I also have the log of that outcome.)

I have spent 2 weeks researching issues with liquidsoap installed on Pi-4 and Buster but found limited information.

I have a number of Pi's running Darkice, TwoToneDetect and op25. But my knowledge and skills are limited with Raspbian.
On a side note I do have a Pi3 with Stretch, op25 and liquidsoap working fine.

I chose to post on RR because I see one of the feed providers is streaming a feed using Pi4, op25 and liquidsoap, but unable to contact do to privacy settings.

I will post the logs if ask.
 

hhca

Member
Joined
Aug 9, 2019
Messages
54
Location
Australia
how are you going with pi4 op25 performance wise, online the reports are a big boost, im just finalising my pi3 setup
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
903
Location
NE Wisconsin
The apt package installer for liquidosap includes all necessary plugin's when installing on Buster. Pulseaudio doesn't auto-start on Buster, so you'll need to make provisions to start it at boot time, or manually if you require it. I simply added @reboot pulseaudio --start to my crontab that starts pulseaudio at boot time. Liquidsoap will abort at startup if anything is wrong with your op25.liq script. If you've enabled pulseaudio service in op25.liq then it may be aborting at startup because you don't have pulseaudio running. Try liquidsoap again after first adding the startup to your crontab. If liquidsoap still aborts then post your op25.liq.

Bill
 

hhca

Member
Joined
Aug 9, 2019
Messages
54
Location
Australia
Yes, i found my op25/liq install preferenced pulseaudio if i had it installed. but i ended up uninstalling it to simplify things, and its runs fine off alsa.

I was also thinking @ScanYak maybe you can use use the 'report a problem' button for that feed you found and put in your user name and or contact details with question ?
 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
SUCESS! The advice you gave helped highlight some other issues I needed to resolve.
It reminded me to remove -U and add -V -w settings in the op25.sh file.

Everything is running as expected with op25, Pulseaudio, Pulseaudio volume control, and liquidsoap installed properly.
Next will be to set up the icecast function #output.icecast... which I have done in another set-up using liquidsoap. I have been able to run two op25.sh instances at the same time and load on reboot with no issues.

BUT NOW... I have an issue with the udp ports for the second instance of op25.sh. to get the audio out. The first instance I'm using -u 23456, however, I have tried 23457 through 23466 unsuccessfully for the second one. On another installation, I was successful with port 23460 for the second one.
Is there a way of opening other ports?
This is my command for the second instance:
./rx.py --args 'rtl=1' --gains 'lna:37' -S 960000 -q 0 -u 23460 -V -w -T DOD.tsv -v 5 -x 1.0 -2 2> stderr-DOD-1.2
I continue to work through the issue.
 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
These are the stderr logs for both instances:
This one starts up and runs fine with audio...... on port 23456
FIRST 23456
r-osmosdr 0.1.4 (0.1.4) gnuradio 3.7.13.4
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy airspyhf soapy redpitaya freesrp
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
[R82XX] PLL not locked!
Using two-stage decimator for speed=960000, decim=10/4 if1=96000 if2=24000
Project 25 IMBE Encoder/Decoder Fixed-Point implementation
Developed by Pavel Yazev E-mail: pyazev@gmail.com
Version 1.0 (c) Copyright 2009
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see the file ``LICENSE'' for details.
op25_audio::eek:pen_socket(): enabled udp host(127.0.0.1), wireshark(23456), audio(23456)
p25_frame_assembler_impl: do_imbe[1], do_output[0], do_audio_output[1], do_phase2_tdma[0], do_nocrypt[1]
metadata update not enabled
Allocating 15 zero-copy buffers
1574378361.689868 do_metadata state=1: [None] None
1574378379.718008 set tgid=59311, srcaddr=0
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
This one starts up and runs fine with NO audio...... on port 23460
SECOND 23460
gr-osmosdr 0.1.4 (0.1.4) gnuradio 3.7.13.4
built-in source types: file osmosdr fcd rtl rtl_tcp uhd miri hackrf bladerf rfspace airspy airspyhf soapy redpitaya freesrp
Using device #1 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
[R82XX] PLL not locked!
Using two-stage decimator for speed=960000, decim=10/4 if1=96000 if2=24000
Project 25 IMBE Encoder/Decoder Fixed-Point implementation
Developed by Pavel Yazev E-mail: pyazev@gmail.com
Version 1.0 (c) Copyright 2009
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions; see the file ``LICENSE'' for details.
op25_audio::eek:pen_socket(): enabled udp host(127.0.0.1), wireshark(23460), audio(23460)
p25_frame_assembler_impl: do_imbe[1], do_output[0], do_audio_output[1], do_phase2_tdma[1], do_nocrypt[0]
metadata update not enabled
Allocating 15 zero-copy buffers
1574378487.416709 do_metadata state=1: [None] None
 

hhca

Member
Joined
Aug 9, 2019
Messages
54
Location
Australia
there are cmd line tools to check what programs/ports are active/open what if you swap ports between the instances to chek everything is working apart from port setting ? i would have not thought there was any port restrictions within a local machine, but something like iptables would be involved in that. have you set your 2 liquid soap settings scripts to have the correct ports ?
 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
Yes, I have switched them around and used different ports. The one success is port # 23456 always works with different instances. I have had success with the same setup on a Pi3.
boatbod posted, how to Run op25 multiple times , something I'm trying to understand he posted, "just make sure the udp ports and log files don't conflict"
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,316
Location
Talbot Co, MD
I generally increment port number by 10 for each instance. Don't forget you need to specify the port number in the rx.py command line and op25.liq script that starts audio.py
 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
So would that look like?
samplerate=8000, restart_on_error=false, "./audio.py -s -u 23466")) ... in op25.liq

So would I need to start a second op25.liq for the second instance?
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,316
Location
Talbot Co, MD
So would that look like?
samplerate=8000, restart_on_error=false, "./audio.py -s -u 23466")) ... in op25.liq

So would I need to start a second op25.liq for the second instance?

Yes, that is correct.
Conceivably you could define two sources within a single .liq file, but it is easier to duplicate the script (with changes) and then run two instances.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
903
Location
NE Wisconsin
Defining two sources within the same .liq file does work very well. Shown below is how I setup one of my op25.liq files setup to accomplish dual instances of op25 streaming to a local icecast server. This configuration also adds some audio processing (AGC) to level out volume differences that can be tweaked as may be necessary for your particular p25 systems.

If also streaming the metadata, then you'll also need separately named meta.json files (meta1.json, meta2.json), each configured to match their respective host, mount, and passwords as defined in the output.icecast … sections of your op25.liq file. Call these with their respective names from your rx.py command lines.

Example op25.liq file

#!/usr/bin/liquidsoap
# Example liquidsoap streaming from op25 to icecast
# (c) 2019, gnorbury@bondcar.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)
# Compress and normalize, producing a more uniform and "full" sound.
# @category Source / Sound Processing
# @param s The input source.
def nrj(s)
compress(threshold=-20.,ratio=3.,gain=3.,normalize(s))
end
input_A = nrj(mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -u 23456 -s -x 2")))
input_B = nrj(mksafe(input.external(buffer=0.25, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -u 23466 -s -x 2")))

# 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.
# LOCAL AUDIO
# 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="OP25-1", url="", fallible=false, icy_metadata="false", host="localhost", port=8000, mount="op25-1", password="hackme, mean(input_A))
output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), description="op25", genre="OP25-2", url="", fallible=false, icy_metadata="false",host="localhost", port=8000,mount="op25-2", password="hackme",mean(input_B))


Bill
 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
Thanks for all the good information provided here on the board. As the "op" I'm working my way through a few issues to achieve the goal of having two op25s and liquidsoap feeding one stream to Broadcastify on one Raspi4 using Buster.

Currently, I have a Raspi4 with Buster running two op25s (no liquidsoap) providing audio out to the earphone jack. An audio cable is plugged into an SDR dongle into another Raspi3 to feed to Broadcastify using Darkice. All very stable deployed in another city 100 miles away with VNC and Wemo Mini switch for control.

I've been successful testing a Raspi3 with Stretch with two op25s and liquidsoap feeding audio out but not with Raspi4 using Buster.

So what is the problem? When I have Raspi4 w/ Buster and Liquidsoap running and the audio out to the earphone jack, Liquidsoap freezes and audio goes silent after a few minutes to a few hours. Op25 continues to function normally. Don't know if it is a Raspi4, Buster or Liquidsoap problem. I'm doing a clean fresh install on my test Raspi4 but, Thanksgiving is coming up so I will take a break.

You might wonder why would I change something that is running stable? .... to see if I can. It's a hobby.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
903
Location
NE Wisconsin
ScanYak,

I have several RPi-3B's and some 4Bs' running op25 and liquidsoap on Stretch and Buster streaming audio and metadata to BCFY with zero stability issues. However, I only have used the dual instances of op25 for my own private server and will recheck to see if any of the resources become exhausted after prolonged operating interval to see if I can reproduce the same issue.

All my single instances of op25 with liquidsoap run 24x7 and work like a champ! I run both as a service that allows me to periodically run a git pull to keep op25 updated or to make adjustments to my whitelists without having to drop the audio stream (connection) to broadcastify.com. It's just a simple matter of restarting the op25-rx.service independent of liquidsoap, and presto, I am good to go with no need to reboot with only a very brief interruption of the feed.

Let us know after holiday and fresh rebuild if you're still are having issues with the audio going to sleep. Hopefully someone here will be able to help diagnose the problem.

Bill
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,316
Location
Talbot Co, MD
I've been running a three-instance headless op25/liquidsoap streaming server for many months. Until recently I would have said it was flawless, but some issues with frequency changes did cause one of the feeds to go down a couple times. Now that I've resolved that it's working fine again, so I would echo Bill's comment that there are no specific stability issues with the software setup regardless of number of instances. I don't doubt that something is wrong, but it's most likely config or tuning related.
 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
Thanks for all of the encouragement and confirmation that it can be done and that there are no known issues that are inherent with setups we are using. The Raspis have been a great replacement for the old HP Compact Thin Clients I was using.
Again thanks to all of you that have spent hours persuing this hobby to allow the rest of us to experience.
 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
If I wanted to have two input sources in the op25.liq file like this:

input_A = mksafe(input.external(buffer=0.02, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -s -u 23456"))
input_B = mksafe(input.external(buffer=0.02, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -s -u 23466"))

..... but I wanted to send it to one icecast feed how would I change this line to accept both inputs?

output.icecast(%mp3(bitrate=16, samplerate=22050, stereo=false), fallible=false, icy_metadata="false", host="localhost", port=8000, mount="mountpoint", password="hackme", mean(input))
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,316
Location
Talbot Co, MD
You need to mix the two inputs into a single stream. I think you can do this with the add() command, but I'm not certain of the exact syntax.
 

wgbecks

Active Member
Joined
Jan 17, 2005
Messages
903
Location
NE Wisconsin
Try it like this....

input_A = mksafe(input.external(buffer=0.02, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -s -u 23456"))
input_B = mksafe(input.external(buffer=0.02, channels=2, samplerate=8000, restart_on_error=false, "./audio.py -s -u 23466"))

combined_AB = add(normalize=false, [input_A,input_B])

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="hackme", mean(combined_AB))


Suggestion

Increase the buffer value from the default 0.02 to 0.25 to avoid the possibility of clipped (loss of) audio fragments when running op25 and liquidsoap on the Raspberry Pi or similar SBC. I also typically add (-x 2) to the (./audio.py …. ) to increase the audio output level because the recovered p25 IMBE/AMBE vocoder level is a bit low resulting in a rather low average audio output (volume) level going upstream to your Icecast server or to BCFY feeds.

Bill





 

ScanYak

Member
Feed Provider
Joined
Apr 22, 2009
Messages
157
Location
Eastern Washington
Thank you Bill for that kind of information. I was able to accomplish my overall goal and now will be doing some long term endurance testing, if nothing else shows up.
 
Status
Not open for further replies.
Top