OP25 audio and errors

Status
Not open for further replies.

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
@boatbod I am needing some help if you could take a look at my setup

rx.py
Code:
./rx.py --args 'rtl' -N 'LNA:47' -S 250000 -q 0 -v 1 -2 -T trunk.tsv -V -n -M meta.json -w 2> stderr.2

op25.liq
Code:
#!/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", 3)

# 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.

# 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="Spalding County Public Safety", genre="Public Safety", url="", fallible=false, icy_metadata="false", host="audio9.broadcastify.com", port=80, mount="xcjkdymvz0f2", password="mypassword", mean(input))

meta.json
Code:
{"icecastPass": "mypassword", "icecastMountpoint": "xcjkdymvz0f2", "icecastServerAddress": "audio9.broadcastify.com:80", "delay": "0.0", "icecastMountExt": ".m3u"}

log on op25.liq - it quits immediately
Code:
2019/08/28 20:37:18 >>> LOG START
2019/08/28 20:37:17 [main:3] Liquidsoap 1.3.3
2019/08/28 20:37:17 [main:3] Using: bytes=[distributed with OCaml 4.02 or above] pcre=7.2.3 dtools=0.4.0 duppy=0.7.2 duppy.syntax=0.7.2 cry=0.6.2 mm=0.3.1 xmlplaylist=0.1.3 lastfm=0.3.0 ogg=0.5.2 vorbis=0.7.1 opus=0.1.2 speex=0.2.1 mad=0.4.4 flac=0.1.3 flac.ogg=0.1.3 dynlink=[distributed with Ocaml] lame=0.3.2 shine=0.2.0 gstreamer=0.2.0 frei0r=0.1.0 theora=0.3.1 gavl=0.1.5 bjack=0.1.4 alsa=0.2.3 ao=0.2.0 samplerate=0.1.2 taglib=0.3.1 magic=0.7.3 camomile=0.8.5 yojson=1.3.2 faad=0.4.0 soundtouch=0.1.7 portaudio=0.2.1 pulseaudio=0.1.2 ladspa=0.1.4 dssi=0.1.1 sdl=0.9.1 camlimages=4.2.0 lo=0.1.0 gd=1.0a5
2019/08/28 20:37:17 [gstreamer.loader:3] Loaded GStreamer 1.14.4 0
2019/08/28 20:37:17 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder.
2019/08/28 20:37:18 [frame:3] Using 8000Hz audio, 25Hz video, 8000Hz master.
2019/08/28 20:37:18 [frame:3] Frame size must be a multiple of 320 ticks = 320 audio samples = 1 video samples.
2019/08/28 20:37:18 [frame:3] Targetting 'frame.duration': 0.04s = 320 audio samples = 320 ticks.
2019/08/28 20:37:18 [frame:3] Frames last 0.04s = 320 audio samples = 1 video samples = 320 ticks.
2019/08/28 20:37:18 [threads:3] Created thread "generic queue #1".
2019/08/28 20:37:18 [threads:3] Created thread "generic queue #2".
2019/08/28 20:37:18 [threads:3] Created thread "non-blocking queue #1".
2019/08/28 20:37:18 [threads:3] Created thread "non-blocking queue #2".
2019/08/28 20:37:18 [input.external_7212:3] Starting process
2019/08/28 20:37:18 [clock.wallclock_pulse:2] Error when starting output pulse_out(liquidsoap:): Pulseaudio error: Connection refused!
2019/08/28 20:37:18 [clock.wallclock_pulse:3] Raised by primitive operation at file "pulseaudio.ml" (inlined), line 47, characters 6-67
2019/08/28 20:37:18 [clock.wallclock_pulse:3] Called from file "io/pulseaudio_io.ml", line 83, characters 13-190
2019/08/28 20:37:18 [clock.wallclock_pulse:3] Called from file "tools/start_stop.ml", line 99, characters 6-16
2019/08/28 20:37:18 [clock.wallclock_pulse:3] Called from file "clock.ml", line 237, characters 19-37
2019/08/28 20:37:18 [xcjkdymvz0f2:3] Connecting mount xcjkdymvz0f2 for source@audio9.broadcastify.com...
2019/08/28 20:37:18 [xcjkdymvz0f2:3] Connection setup was successful.
2019/08/28 20:37:18 [threads:3] Created thread "wallclock_pulse" (1 total).
2019/08/28 20:37:18 [clock.wallclock_pulse:3] Streaming loop starts, synchronized by active sources.
2019/08/28 20:37:18 [main:3] Shutdown started!
2019/08/28 20:37:18 [main:3] Waiting for threads to terminate...
strange error flushing buffer ...
strange error flushing buffer ...
2019/08/28 20:37:18 [xcjkdymvz0f2:3] Closing connection...
2019/08/28 20:37:18 [clock.wallclock_pulse:3] Streaming loop stopped.
2019/08/28 20:37:18 [threads:3] Thread "wallclock_pulse" terminated (0 remaining).
2019/08/28 20:37:18 [main:3] Threads terminated.
2019/08/28 20:37:18 [input.external_7212:3] Cleaning up process
2019/08/28 20:37:18 [threads:3] Shutting down scheduler...
2019/08/28 20:37:18 [threads:3] Scheduler shut down.
2019/08/28 20:37:18 [threads:3] Thread "generic queue #2" terminated.
2019/08/28 20:37:18 [main:3] Cleaning downloaded files...
2019/08/28 20:37:18 [main:3] Freeing memory...
2019/08/28 20:37:18 [threads:3] Thread "non-blocking queue #2" terminated.
2019/08/28 20:37:18 [threads:3] Thread "generic queue #1" terminated.
2019/08/28 20:37:18 >>> LOG END


No issues picking up the signal - just not hearing anything because op25.liq is not starting...
Code:
NAC 0xa WACN 0x924b3 SYSID 0xa 852.350000/807.350000 tsbks 10600
voice frequency 851.225000 tgid(s) 10 None 17.2s ago count 116
voice frequency 851.325000 tgid(s) 2 None 13.0s ago count 169
voice frequency 851.600000 tgid(s) 10 None  9.8s ago count 139
voice frequency 852.187500 tgid(s) 10 None 12.5s ago count 1
voice frequency 852.200000 tgid(s) 10 None  7.2s ago count 110
voice frequency 852.812500 tgid(s) 2 None  2.6s ago count 148
voice frequency 853.637500 tgid(s) 10 None  2.6s ago count 116













Frequency 852.350000(0)


Good news - I got it working! I had to kill the pulseaudio, uninstall and reinstall. Started it back up and op25.liq is working like a champ. Streaming is working fairly well. I was wondering if I might be able to use something like this to be able to clean up the audio a little bit - the dynamics are so varied:

ksigWyatt/Pi-Audio-Compressor

This is the link to the feed - would love to get some feedback from other streamers on audio quality. This is not an extremely busy channel:

Spalding County Public Safety Live Audio Feed
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
UPDATE: Found this post and was able to get it working with the suggestion here:
OP25 fails to start as a service


Good news - I got it working! I had to kill the pulseaudio, uninstall and reinstall. Started it back up and op25.liq is working like a champ. Streaming is working fairly well. I was wondering if I might be able to use something like this to be able to clean up the audio a little bit - the dynamics are so varied:

ksigWyatt/Pi-Audio-Compressor

This is the link to the feed - would love to get some feedback from other streamers on audio quality. This is not an extremely busy channel:

Spalding County Public Safety Live Audio Feed


OK - now I am getting an error when trying to run it as a service:

When I run it from op25.sh
Code:
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 #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Using two-stage decimator for speed=250000, decim=5/2 if1=50000 if2=25000
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::open_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[1], do_nocrypt[1]
Reading whitelist file
added talkgroup 2 from whitelist.txt
added talkgroup 101 from whitelist.txt
added talkgroup 721 from whitelist.txt
added talkgroup 301 from whitelist.txt
added talkgroup 322 from whitelist.txt
added talkgroup 401 from whitelist.txt
streaming server url="http://audio9.broadcastify.com:80/xcjkdymvz0f2.m3u"
Allocating 15 zero-copy buffers
1567046296.098180 control channel timeout
1567046306.073626 voice update:  tg(2), freq(853637500), slot(-), prio(3)
1567046310.768877 control channel timeout
1567046310.789257 voice update:  tg(2), freq(851225000), slot(-), prio(3)
1567046313.917744 control channel timeout
1567046314.451223 voice update:  tg(2), freq(851325000), slot(-), prio(3)
1567046318.110809 control channel timeout
1567046319.693609 voice update:  tg(2), freq(852200000), slot(-), prio(3)
1567046323.362217 control channel timeout
1567046323.894041 voice update:  tg(2), freq(853637500), slot(-), prio(3)


When I run it as a service:

Code:
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 #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
Exact sample rate is: 250000.000414 Hz
[R82XX] PLL not locked!
Using two-stage decimator for speed=250000, decim=5/2 if1=50000 if2=25000
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::open_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[1], do_nocrypt[1]
Reading whitelist file
added talkgroup 2 from whitelist.txt
added talkgroup 101 from whitelist.txt
added talkgroup 721 from whitelist.txt
added talkgroup 301 from whitelist.txt
added talkgroup 322 from whitelist.txt
added talkgroup 401 from whitelist.txt
terminal: exception occurred (0, 0)
terminal: exception:
Traceback (most recent call last):
  File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 306, in run
    self.setup_curses()
  File "/home/pi/op25/op25/gr-op25_repeater/apps/terminal.py", line 67, in setup_curses
    self.stdscr = curses.initscr()
  File "/usr/lib/python2.7/curses/__init__.py", line 33, in initscr
    fd=_sys.__stdout__.fileno())
error: setupterm: could not find terminal

streaming server url="http://audio9.broadcastify.com:80/xcjkdymvz0f2.m3u"
Allocating 15 zero-copy buffers
Flowgraph completed. Exiting

op25-rx.service located in /etc/systemd/system
Code:
[Unit]
Description=op25-rx
After=syslog.target network.target nss-lookup.target network-online.target
Requires=network-online.target

[Service]
User=pi
Group=pi
WorkingDirectory=/home/pi/op25/op25/gr-op25_repeater/apps
ExecStart=/bin/bash -- op25.sh
RestartSec=5
Restart=on-failure

[Install]
WantedBy=multi-user.target

op25.sh
Code:
#! /bin/sh

cd /home/pi/op25/op25/gr-op25_repeater/apps

./rx.py --args 'rtl' -N 'LNA:47' -S 250000 -q 0 -v 1 -2 -T trunk.tsv -V -n -M meta.json -w 2> stderr.2

No issues with op25-liq.service
 
Last edited:

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
This is the link to the feed - would love to get some feedback from other streamers on audio quality. This is not an extremely busy channel:

Spalding County Public Safety Live Audio Feed

I pulled one of the recent archives and looked at it in Audacity. Generally the audio quality is very good but there are intermittent pops which I'd attribute to PCM underruns from intermittent loss of AMBE codewords. How does the signal look on the constellation plot and datascope?
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
I took 3 screenshots of the constellation. This first one is during a normal audible transmission:

Screen Shot 2019-08-29 at 6.48.44 PM.png

No radio traffic right after a broadcast:
Screen Shot 2019-08-29 at 6.49.00 PM.png

Then it sits here while there is silence
Screen Shot 2019-08-29 at 6.49.10 PM.png


The datascope 98% of the time looks similar to this:
Screen Shot 2019-08-29 at 6.58.29 PM.png

The other times - usually right after a transmission but not every transmission:
Screen Shot 2019-08-29 at 7.00.02 PM.png

What range should the frequency errors be in? While sitting here monitoring it there were a couple of times it got over 400Hz.
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
I pulled one of the recent archives and looked at it in Audacity. Generally the audio quality is very good but there are intermittent pops which I'd attribute to PCM underruns from intermittent loss of AMBE codewords. How does the signal look on the constellation plot and datascope?
Could my buffer size be too large? I am still staying well bellow 20% CPU.

This is constant in my stderr2 log:
Screen Shot 2019-08-29 at 7.12.43 PM.png


And I don't know if these mean anything - is this supposed to be happening on the .liq side?
Screen Shot 2019-08-29 at 7.26.37 PM.png
 
Last edited:

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
The liquidsoap log messages can be ignored - they just show when silence is being injected instead of voice traffic.
The op25 plots look nice and tight when signal is present. The scrambled/random data is shown when no signal is present on the tuned channel. Is it possible you have additional control channel frequencies programmed into your trunk.tsv file?
It might be worth temporarily upping the op25 verbosity to "-v 10" so that I can check why you are seeing the control channel timeouts?
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
The liquidsoap log messages can be ignored - they just show when silence is being injected instead of voice traffic.
The op25 plots look nice and tight when signal is present. The scrambled/random data is shown when no signal is present on the tuned channel. Is it possible you have additional control channel frequencies programmed into your trunk.tsv file?
It might be worth temporarily upping the op25 verbosity to "-v 10" so that I can check why you are seeing the control channel timeouts?
I do have multiple control channels listed, but it has stayed consistently on 852.350 since I started the RPi journey. See attached file for a few minutes of the v-10 stderr.2 file. There was a decent bit of traffic but mostly silence during that time. I also bumped the buffer in op25.liq to .50 from .25 last night just to see if that made a difference, but I did not notice anything.
 

Attachments

  • stderr.txt
    1.2 MB · Views: 9

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
I do have multiple control channels listed, but it has stayed consistently on 852.350 since I started the RPi journey. See attached file for a few minutes of the v-10 stderr.2 file. There was a decent bit of traffic but mostly silence during that time. I also bumped the buffer in op25.liq to .50 from .25 last night just to see if that made a difference, but I did not notice anything.
I see TDU / DUID15 at the end of the voice transmissions, but for some reason it doesn't seem to immediately switch back to the control channel. Could you do me a favor and up the logging to "-v 11" and try again. Thanks.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
I see TDU / DUID15 at the end of the voice transmissions, but for some reason it doesn't seem to immediately switch back to the control channel. Could you do me a favor and up the logging to "-v 11" and try again. Thanks.
I just added an extra debug to show tuning requests. Please do a "git pull" and update to the latest version before re-running the log at level 11.
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
I just added an extra debug to show tuning requests. Please do a "git pull" and update to the latest version before re-running the log at level 11.

I was able to do the git pull - hope this is enough log information - let me know if not...
 

Attachments

  • stderr_v11.txt
    1.2 MB · Views: 13
S

simpilo

Guest
I hope you redact those broadcastify mount point lines. someone might try to steal your feed. Just being safe.
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
I hope you redact those broadcastify mount point lines. someone might try to steal your feed. Just being safe.

Doesn't look like I can do anything about it at this point - thought taking out the password would suffice. I've see other posts in here that did the same thing, but I guess it makes sense. I will be sure to be aware of that moving forward. Thanks for the heads up!
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
I see what is happening and it's actually benign although it is a small oversight in the tuning code.

Your p25 system ceases transmitting very quickly after issuing three TDU duid15s. As a result a framing timeout occurs on the dead voice channel and this is queued to the trunking module, but the latter has already changed state and issued tuning instructions to go back to the control channel. When the timeout message arrives in trunking, it looks like a control channel timeout even though it really isn't.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
I've pushed a small change to rx.py which will hopefully resolve the problem; whenever the tuned frequency changes, all queued but undelivered messages from the p25 decoder will be purged.
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
I've pushed a small change to rx.py which will hopefully resolve the problem; whenever the tuned frequency changes, all queued but undelivered messages from the p25 decoder will be purged.

I pulled the change and did another -v 11 log so you could look at the results. Let me know if you need anything else...
 

Attachments

  • stderr_20190831_180908.txt
    1.4 MB · Views: 6

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
I pulled the change and did another -v 11 log so you could look at the results. Let me know if you need anything else...
Apparently it's not working... appears to be a race condition between the queue watcher thread and trunking.py & rx.py
Going to have to think about this some more.
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,678
Reaction score
1,071
Location
Talbot Co, MD
sqlgeek: if you're up for it, lets try "version 2" and see if that fixes your system :)

Unfortunately this code is a lot more involved as I had to tag received messages (in the c++ library code) with a timestamp to enable the higher level (python) trunking code to figure out whether to process or ignore them. You'll need to do a "git pull" and a "make"/"sudo make install" from the build directory.

Once the new version is up and running, you may see some occasional level 11 logging "ignored due to frequency change" messages. e.g.
Code:
1567473533.155538 NAC 0x4a6 TSBK: op=39 : 39 00 03 06 18 04 04 18 04 04 2c 89
1567473533.155612 NAC 0x4a6 TSBK: op=09 : 09 90 0f 00 00 00 00 00 00 00 ef 7f
1567473533.155654 NAC 0x4a6 TSBK: op=16 : 96 00 00 40 ff ff ff ff 00 01 bb ff
type 7 at 1567473533.155667 with ts 1567473533.155521 ignored due to frequency change
type 7 at 1567473533.155800 with ts 1567473533.155607 ignored due to frequency change
type 7 at 1567473533.155900 with ts 1567473533.155651 ignored due to frequency change
This should generally only happen right after a frequency change, and is the result of queued messages received on the old channel being properly dropped as they no longer apply to the new channel.
 

sqlgeek

Member
Joined
Jun 21, 2014
Messages
33
Reaction score
0
Location
Griffin, GA
sqlgeek: if you're up for it, lets try "version 2" and see if that fixes your system :)

Unfortunately this code is a lot more involved as I had to tag received messages (in the c++ library code) with a timestamp to enable the higher level (python) trunking code to figure out whether to process or ignore them. You'll need to do a "git pull" and a "make"/"sudo make install" from the build directory.

Once the new version is up and running, you may see some occasional level 11 logging "ignored due to frequency change" messages. e.g.
Code:
1567473533.155538 NAC 0x4a6 TSBK: op=39 : 39 00 03 06 18 04 04 18 04 04 2c 89
1567473533.155612 NAC 0x4a6 TSBK: op=09 : 09 90 0f 00 00 00 00 00 00 00 ef 7f
1567473533.155654 NAC 0x4a6 TSBK: op=16 : 96 00 00 40 ff ff ff ff 00 01 bb ff
type 7 at 1567473533.155667 with ts 1567473533.155521 ignored due to frequency change
type 7 at 1567473533.155800 with ts 1567473533.155607 ignored due to frequency change
type 7 at 1567473533.155900 with ts 1567473533.155651 ignored due to frequency change
This should generally only happen right after a frequency change, and is the result of queued messages received on the old channel being properly dropped as they no longer apply to the new channel.

OK here is the latest log...
 

Attachments

  • log.txt
    460.4 KB · Views: 1

rdwrench

Member
Joined
Aug 22, 2006
Messages
7
Reaction score
0
Okay Boatbod....I built a new system with more performance and usb 3 slots running a hackrf.....I'm using the antenna that came with the hackrf as mine outside needs to have a new cable run to it...waiting for cooler weather....I get great reception as I'm close to a repeater...no sound even after running all day. I've adjusted the frequency to adjust the dot patterns and they are rock solid. I've enabled v10 to the log file....can you tell me how to analyze this please? I get the correct talk groups decoded but need some help with what the radio is looking for....if I have to i'll move wireshark over if it would help....Thanks in advance.....

>w
 
Status
Not open for further replies.
Top