Neoklis,
I assume from the brief CV on your website that you are getting to grips
with DSP. Please forgive me if I have made any poor assumptions.
Looking at https://github.com/Guenael/rtlsdr-wsprd, the original code
that processed RTL reception to WSPR reception acted as follows:
* did some preparatory stuff, and started processing IQ samples from
an RTL-SDR
* decimated IQ data from ~2 M sample/s to around 375 sample/s
* decoded WSPR signals (presumably within about a 200 Hz bandwidth)
* performed some housekeeping
* and repeated the process (according to the WSPR 2 minute schedule.)
In the Roman legion, decimate meant the death of one tenth part of the
prior strength. In DSP, decimate is used to mean a reduction in sample
rate by a large, usually integer (sometimes integer fraction), factor.
That might be a factor of 2, or 3, or 10, as required. There is more
than one way of achieving this end, and most commonly the mechanism used
provides other functionality(-ities) beyond simple decimation.
Also, it is at the processing chain designer's discretion as to whether
samples are processed as IQ pairs, or, at some stage, are treated as
single samples, such as are required for an SSB audio output.
Looking at the code—Read The Source, Luke—for *rtlsdr_wsprd.c*:
a) lines 138-152, are a compensation FIR filter for a CIC filter
(CIC = cascaded integrator comb), which is a construct for providing
large decimation ratios with minimal processing (see, for example,
url:https://dspguru.com/dsp/tutorials/cic-filter-introduction/)
b) line 190 starts a *for* loop which sets up a CIC structure. The
*integrator stage* is implemented to offer division of sample rate
by 4 which happens in ll 190-195, using infrastructure set up
immediately above. (The order of integrator and comb stages is
arbitrary)
c) immediately following are two *comb* stages, followed by a
*compensation* FIR filter which flattens the overall passband
frequency response
d) the *for* loop ends at line 244
e) the CIC has performed a downsampling *directly* from
2.4 M sample/s to 375 sample/s
f) the constants which control this are to be found on ll 38-41:
#define SAMPLING_RATE 2400000
#define FS4_RATE SAMPLING_RATE / 4
#define DOWNSAMPLING SAMPLING_RATE / SIGNAL_SAMPLE_RATE
#define SIGNAL_SAMPLE_RATE 375
g) so, with a following wind, setting SAMPLING_RATE to 192000 and
presenting an appropriate stream of IQ samples, should be very close
to what you are looking for. But there are some issues to be aware of:
i) the RTL-SDR samples are (unsigned) *8 bits*, which are
converted to *signed* 8 bits at line 172 and following
ii) what follows line 262 is concerned with the WSPR decoding
mechanisms and housekeeping. 262-328 looks to be the main
decoding loop at first glance.
iii) deep breaths are advised when reading this code
iv) in principle one could refactor the code to deal with 16 bit
samples. For test purposes, and possibly for general
application, then adding noise (as outlined below) and
truncating the samples from 16 bit to 8 bit should result in
WSPR decodes.
v) refactoring the code to deal with 16 bit samples, rather than
8 bit samples would be a *much* cleaner and more reliable
solution. A possible part way solution would be the addition of
8 bit (rms) white noise to incoming 16 bit samples, followed by
16→8 bit conversion (losing the lower 8 bits). The dynamic range
drops to about 48dB (though it's a bit more complicated.)
Hopefully, that gives you some sort of a route map.
HTH, 73, Stay Safe,
Robin, G8DQX
On 01/04/2022 16:58, Neoklis Kyriazis via wsjt-devel wrote:
Hi all
I have just joined this email list as I became interested in incorporating WSPR
code into a client I am developing for the ANAN-7kDLE Mk2 HPSDR Tcvr. This
client app has support for the usual modes (SSB, CW, FM) and I would like to
add WSPR mode too.
I used the rtlsdr-wsprd application as a starting point and have already
incorporated most of the functions in it to my client. However, I am having
difficulty understanding how to supply the decoder code with I/Q samples
from my tcvr. As far as I can tell, rtlsdr-wsprd performs some type of mixing
of the sample stream at 1/4 the sampling rate and then down-samples it to
375 S/s. In my client I have available the I/Q stream from the Rx at 192kS/
and also have a filtered and down-sampled stream at 48kS/s which is used
by the demodulator functions. There is also the demodulated audio stream
available at 48kS/s.
I would like to know if it is possible to supply the decoder with the 48k audio
stream, since this can be filtered to a narrow bandwidth to improve reception.
I would also much appreciate any hints as to how I could use the
un-demodulated IQ stream, if audio cannot be used.
My Thanks in advance!
--
Best Regards
Neoklis - Ham Radio Call:5B4AZ
http://www.5b4az.org/
https://www.qsl.net/5b4az/index.html
_______________________________________________
wsjt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wsjt-devel