OP25 OP25 (Boatbod) compiled on arch no sound

excentric

Member
Premium Subscriber
Joined
Mar 10, 2018
Messages
6
Reaction score
2
I recompile OP25 gr310 branch and every compiled fine (arch) but when I run :
./rx.py --args "rtl" --gains 'lna:46' -S 960000 -X -q 0 -v 1 -2 -V -U -T trunk.tsv 2> stderr.2

I get this error in my Stderr.2:

sing Python /usr/bin/python3
gr-osmosdr 0.2.0.0 (0.2.0) gnuradio 3.10.9.2
built-in source types: file rtl rtl_tcp uhd hackrf bladerf rfspace airspy soapy redpitaya
Using device #0 Realtek RTL2838UHIDIR SN: 00000001
Found Rafael Micro R820T tuner
[R82XX] PLL not locked!
gain: name: LNA range: start 0 stop 49 step 0
setting gain lna to 46
supported sample rates 250000-2560000 step 24000
[R82XX] PLL not locked!
demodulator: xlator if_rate=24000, input_rate=960000, decim=40, taps=193, resampled_rate=24000, sps=5
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[1], do_nocrypt[0]
metadata update not enabled
using ALSA sound system
audio device: default
Listening on 127.0.0.1:23456
python version detected: 3.11.8 (main, Feb 12 2024, 14:50:05) [GCC 13.2.1 20230801]
03/24/24 11:23:27.179068 Reconfiguring NAC from 0x000 to 0x3a2
03/24/24 11:23:27.864920 voice update: tg(2405), freq(856812500), slot(0), prio(3)
03/24/24 11:23:30.322197 voice update: tg(1451), freq(853650000), slot(0), prio(3)
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 59, in _wrapfunc
return bound(*args, **kwds)
^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/numpy/core/_methods.py", line 99, in _clip
return um.clip(a, min, max, out=out, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'clip' output from dtype('float32') to dtype('int16') with casting rule 'same_kind'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
self.run()
File "/home/gene/radio/op25/op25/gr-op25_repeater/apps/sockaudio.py", line 553, in run
self.sock_audio.run()
File "/home/gene/radio/op25/op25/gr-op25_repeater/apps/sockaudio.py", line 468, in run
data_a = self.scale(data_a)
^^^^^^^^^^^^^^^^^^
File "/home/gene/radio/op25/op25/gr-op25_repeater/apps/sockaudio.py", line 486, in scale
arr = np.clip(arr*self.audio_gain, -32767, 32766, out=result)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 2169, in clip
return _wrapfunc(a, 'clip', a_min, a_max, out=out, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 68, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/numpy/core/fromnumeric.py", line 45, in _wrapit
result = getattr(asarray(obj), method)(*args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/numpy/core/_methods.py", line 99, in _clip
return um.clip(a, min, max, out=out, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
numpy.core._exceptions._UFuncOutputCastingError: Cannot cast ufunc 'clip' output from dtype('float32') to dtype('int16') with casting rule 'same_kind'
03/24/24 11:23:37.290059 voice update: tg(1451), freq(856487500), slot(1), prio(3)

Not sure but I see that its realated to the sockaudio.py . Anybody have any suggestions?
 

boatbod

Member
Joined
Mar 3, 2007
Messages
3,595
Reaction score
997
Location
Talbot Co, MD
The particular piece of sockaudio.py code that triggers the error is this:
Code:
    def scale(self, data):  # crude amplitude scaler (volume) for S16_LE samples
        arr = np.array(np.frombuffer(data, dtype=np.int16), dtype=np.float32)
        result = np.zeros(len(arr), dtype=np.int16)
        arr = np.clip(arr*self.audio_gain, -32767, 32766, out=result)
        return result.tobytes('C')
It's purpose is to convert from floating point samples used internally by op25 into int16 samples used by pulse/alsa sound system.
Nothing has changed in this code, so I can only assume your version of numpy got updated and now it doesn't like what previously worked.

ETA: further research shows that default numpy.ufunc casting rules were changed from "unsafe" to "same_type" in version 1.10
I have posted a fix which should get things working again.
 
Last edited:

excentric

Member
Premium Subscriber
Joined
Mar 10, 2018
Messages
6
Reaction score
2
The particular piece of sockaudio.py code that triggers the error is this:
Code:
    def scale(self, data):  # crude amplitude scaler (volume) for S16_LE samples
        arr = np.array(np.frombuffer(data, dtype=np.int16), dtype=np.float32)
        result = np.zeros(len(arr), dtype=np.int16)
        arr = np.clip(arr*self.audio_gain, -32767, 32766, out=result)
        return result.tobytes('C')
It's purpose is to convert from floating point samples used internally by op25 into int16 samples used by pulse/alsa sound system.
Nothing has changed in this code, so I can only assume your version of numpy got updated and now it doesn't like what previously worked.

ETA: further research shows that default numpy.ufunc casting rules were changed from "unsafe" to "same_type" in version 1.10
I have posted a fix which should get things working again
Ok it works like a charm
I figured out what you meant by you posted a fix
 
Top