# How to get the "real" number of samples coming in an sdr

so I am fairly new to this SDR and dsp thing, I am working on a project that calculates the ppm and adjusts the offset, now I kinda got the idea of how to calculate the ppm after going through the rtl_test source code, but for that, I need the number of samples in a time frame( as in frequency offset, the sample rate changes a tad bit). Now I am not sure how to approach that, can someone guide me on that? I see there is some rtl_read_async function in c that probably has a parameter that is passed by reference and returns the number of samples received, but I am not sure how to use it as I can't seem to find any documentation.

• what is "the ppm"? Mar 22, 2021 at 22:24
• and the sample rate is the number of samples per unit time, so why is "the number of samples in a time frame" different? If you want to know how many samples there are in 10 seconds, just multiply the sample rate, in samples per second, by 10, right? Mar 22, 2021 at 22:25
• So basically, when the oscillator of an sdr goes bonkers due to heat, your time*sample_rate does not give you exact number of samples, so, if you go through the source code of rtl_test, it calculates the real_rate of the sdr and calculates the ppm , the equation is ppm=1e6*(real_rate/sample_rate-1) Mar 23, 2021 at 7:30
• "ppm" is a unit, meaning "parts per million". Calculating "the ppm" is like calculating "the centimeters." What you're looking to do is probably "calibrate the sample rate" or "estimate the sample rate error". Mar 23, 2021 at 13:32