|Subject:||Re: [Discuss-gnuradio] Adjusting Sampling Frequency of Custom C++ Source Block Help|
|Date:||Tue, 8 Dec 2015 12:29:41 +0100|
|User-agent:||Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0|
On 08.12.2015 03:45, Charles Bridger wrote:
So: welcome! We really don't mind answering questions around here, so don't be afraid to ask anything you can't find an answer to.
Nice starter project!
So, this is one thing that people commonly stumble across when they get in contact with GNU Radio-style DSP:
sampling rate is really just a number used to calculate the number of samples your sine takes to make a full period.
GNU Radio doesn't have any concept of real-world sampling rates, and it shouldn't: It just processes the samples it gets as fast as possible. Try it! Take the signal source you get with GNU Radio, set the sampling rate to 10 and the frequency to 1. A period will have 10 samples; the same happens when you set a sampling rate of 1e9 and a frequency of 100e6. When you connect your signal source to a "probe rate" block and let a "message debug" print out the rate at which samples are produced:
you'll see on your console that the sample rate setting has nothing to do with the speed at which samples are produced. They are passed along the flow graph as fast as possible, and since there's no external hardware block in here that actually limits the processing rate, that's as fast as your CPU can run.
So: what you're trying to do is actually build a signal source that combines the features of the signal source with that of the "throttle" block. Throttle does nothing with the signal (really, nothing. It just copies from in- to output), but limits the number of items that pass through it.
It really has no practical value aside from stopping a rate-unlimited block from hogging all your CPU at once, and for visualizations of simulated/recorded signals to slow down things so you can actually see what happens e.g. in a Qt time sink.
Hope that cleared things up a bit; sampling rate is but a number with which some GNU Radio blocks calculate sample-relative frequencies.
|[Prev in Thread]||Current Thread||[Next in Thread]|