Am 14.08.2016 um 12:05 schrieb Alexandru Csete:
> On Sun, Aug 14, 2016 at 10:34 AM, wofritzyt <
wolfgan...@gmx.net> wrote:
>> Hi Alex,
<cut>
>
> All I have done to "fix" the issue is to remove the code that set a
> low latency and use the default pulseaudio latency.
>
I tried this too. The underruns go away, but observed situations where
ltenciy went up to 1-2 seconds. I could not find out what the reason was.
> I can imagine there may still be issues if the hardware does not
> support 48 kHz and pulseaudio has to resample. On the other hand, I
> looked in my pulseaudio configuration files and it seems the global
> sample rate is 44.1 kHz, so pulseaudio may in any case be doing a lot
> of resampling.
>
> By the way, the resampler type and quality can also be configured for
> pulseaudio.
>
with "pactl list sink-inputs" I see for the QGRX sink "Resample method:
copy" so I assume that USB stick supports 48kHz sample rate in hardware
> As far as I remember, we have everything in place to support audio
> rates other than 48 kHz. It's just the GUI part that need finishing.
> So that's also an option.
>
>> One "issue" I observe is that the audio data is processed quite "bursty",
>> meaning the FIFO level in my pa_sink implementation sometimes goes very high
>> and sometimes drops to zero, causing an underrun. I don't know the reason
>> for this. Is it gqrx core delivering data too bursty or is i pulse audio
>> requesting data too bursty or is it a non optimal interaction between the
>> gqrx write thread and the pulse audio read thread.
>
> It's the GNU Radio scheduler that determines that, although I think it
> is pretty much driven by how samples are delivered from the input
> source.
>
M< suspicion is that the samples are delivered in bursts and also some
large buffers in the low level drivers that in the end cause the latency.
I am wondering how to measure the latency in the different software
stages. In hardware, I would attach a scope probe to the points I want
to observe (like I did with the overall latency measurement). But how to
do it in software? First step could be logging of data transfers from
the device (chunk sizes and time stamps) which could give an idea how
bursty the data comes from the low level driver. As it seems not to be
very difficult to connect additional blocks to the signal path, could I
attach some kind of level detector at the input and the output of the
gnuradio signal path which logs a time stamp when signal crosses some
threshold? or even send a pulse on some control line of the serial port
that I connect to the scope?
(Just for the laughs: I added a 9 dB amplifier block after the AM
detector because AM audio was much lower than SSB audio)
>
>> BTW, because I have no crackling audio with cubicsdr. I checked the code and
>> the pulse audio sink is basically the same as in gqrx, using pulse audio
>> "simple" API.. But it goes the "safe" way and configures pulse audio buffers
>> for 100ms latency. This is good enough even for my USB stick, but adds quite
>> some latency, so total latency with cubicsdr is 400ms from RF in to AF out
>> which is much more than gqrx.
>
> If it helps, we can add the latency parameter as a configuration
> option. It is also available in the simple API.
>
> While looking into audio issues on the Raspberry Pi, I saw someone
> recommending to comment out the following line in
> /etc/pulse/
default.pa:
> load-module module-suspend-on-idle
>
> That had also something to do with crackling, in that the device was
> constantly switched on and off.
>
> By the way, I just tried to see the RF-to-audio latency on my
> computer, using a Funcube Dongle Pro+. It didn't feel like more than
> 50 msec between keying and audio, maybe even less.
>
This is another indication that the main latencies in my system are in
the low level driver part. Unfortunately, this is proprietary software.
The SDRPlay hardware is not bad for the money, but the proprietary
drivers more and more become a problem for me. So I am considering
getting an SDR device which is at least as good as the SDRPlay, but has
fully open source drivers and is known to work well under Linux. Do you
have a recommendation?
Regards,
Wolfgang
> Alex
>