Sunday, January 2, 2022

WSJT-X and Gnuradio audio, usrp sink underflows

The context is that I am developing a transceiver that
uses external software (WSJT-X) as a sink for audio (on receive) and a source
for audio (on transmit).  WSJT-X on
receive essentially decodes signals in the audio stream.  On transmit it generates the signal at
baseband.



My USRP device is an Ettus B205mini.  My system is Ubuntu 20.04.3 LTS.  GRC version is 3.9.4.0.  UHD version is 3.15.0.



There are two audio streams between WSJT-X and GRC, specified
separately.  GRC to WSJT-X on receive,
WSJT-X to GRC on transmit.  In WSJT-X,
the options for devices are chosen by pull-down menus.  For the audio input device, the choices are WSJT-X
allows choice of the device for the audio input and of the device from audio
output.  These are chosen from pull-down
menus.  For the WSJT-X audio input, these
are the devices reported by (aplay -L) plus the sources reported by (pactl list-sources).  For the WSJT-X audio output, these are the
devices reported by (arecord -L) and pactl list -sinks).  WSJT requires 48 kHz rates.



I have created two loopback devices by



sudo modprobe snd-aloop
enable=1,1 index=10,11



This shows up in (aplay -L) as the devices



 plughw:CARD=Loopback,DEV=0



plughw:CARD=Loopback,DEV=1



hw:CARD=Loopback,DEV=0



plughw:CARD=Loopback_1,DEV=1





plughw:CARD=Loopback_1,DEV=0



plughw:CARD=Loopback_1,DEV=1



hw:CARD=Loopback_1,DEV=0



plughw:CARD=Loopback_1,DEV=1



For the transmit stream, the GRC audio source Device
Name is plughw:CARD=Loopback_1,DEV=1, with OK to Block is set no, rate is
48000. In WSJTX, the audio output device is plughw:CARD=Loopback_1,DEV=0.



My problem is that the USRP sink reports a large
number of underflows:



Ugr::log :ERROR: usrp_sink0 - In the last 750 ms, 2
underflows occurred.



UUUUUUUUUUgr::log :ERROR: usrp_sink0 - In the last 920
ms, 10 underflows occurred.



UUUUUUUUUUUUUUUUUUUUUUUUUUgr::log :ERROR: usrp_sink0 -
In the last 757 ms, 26 underflows occurred.



UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUgr::log
:ERROR: usrp_sink0 - In the last 755 ms, 53 underflows occurred.



Replacing the audio source block by a Signal Source or
by microphone input (default device) gives no underflow errors.



I tried the setup in 
wiki.gnuradio.org/index.php/ALSAPulseAudio#Monitoring_the_audio_input_of_your_system_with_PulseAudio.  
This suggests creating an ALSA Pseudodevice to monitor
audio input.
  This fails with diagnostics



ALSA lib pcm_pulse.c:752:(pulse_prepare) PulseAudio:
Unable to create stream: No such entity



gr::log :ERROR: audio_alsa_source0 - [pulse_monitor]:
snd_pcm_hw_params failed: Input/output error



Traceback (most recent call last):



  File
"/home/dave/mygrc/testwsjtaudio.py", line 333, in <module>



    main()



  File
"/home/dave/mygrc/testwsjtaudio.py", line 313, in main



   
tb.start(5000)



  File
"/usr/lib/python3/dist-packages/gnuradio/gr/top_block.py", line 98,
in start



   
top_block_start_unlocked(self._impl, max_noutput_items)



RuntimeError: check topology failed on
audio_alsa_source(8) using ninputs=0, noutputs=1



Is there anything in the Audio Source block implementation
that causes this behaviour, please?  Any
likely problems in sound configuration? 
Is there a simpler/better/less trouble-prone way of implementing the GRC-WSJT-X
audio traffic?



Any assistance appreciated.



 Dave VK1DJA


No comments:

Post a Comment