I have external device streaming data at fixed sample rate and my GNU
Radio
source block for this device, which feeds flow graph containing some
hardware sink operating at same sample rate (e.g. audio sink). My
source-device and that sink-device (e.g. soundcard on PC) aren’t
synchronized, i.e. they clocked from different sources. So I need to do
some
kind of auto-resampling to eliminate buffer over/under-runs. (Please
correct
me, if I use wrong terminology. I’m novice and just trying to specify
common
DSP task, which I’m sure exists.)
The first trouble is that I don’t know how to make my block adopt to
existing sample rate in graph. GNU Radio scheduler asks my block to
produce
too large chunks of samples which leads to quick underrun of my block’s
internal buffer (even 500ms pre-buffering is not enough!). Actually
there
are no failure, taken data just being moved to somewhere between my
block
and sink (and everything works well when source and sink are
synchronous, I
checked). But(!) my block loses prebuffered level which deviations I
expected to use as reference for corrections. Hungry scheduler eats all
data
in buffer. Moreover, his extra attempts leads to extra CPU usage - this
is
the second trouble. I experimented with inserting thread 'sleep’s in
work()
function and it solves issue but breaks data flow (audio device reports
underruns, more or less frequent depending on sleep interval).
Please, advice on solution. I would appreciate for just pointing me to
right
direction.
–
View this message in context:
http://gnuradio.4.n7.nabble.com/how-to-implement-auto-correction-of-sample-rate-in-flow-graph-tp45268.html
Sent from the GnuRadio mailing list archive at Nabble.com.