[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Discuss-gnuradio] Is there a gnuradio module that uses a file as a
Re: [Discuss-gnuradio] Is there a gnuradio module that uses a file as a source?
Fri, 7 Aug 2009 13:05:12 -0700
On Fri, Aug 7, 2009 at 12:49, Jonathan Coveney<address@hidden> wrote:
> I can't find one. The _cfile.py files will save samples to a file of my
> specification, but I am trying to test using said samples, and not
> succeeding. If it does not exist, I tried this:
> #self.u = usrp.source_c() # usrp is data source
> self.u = gr.file_source(gr.sizeof_gr_complex, "data.dat", False)
> but there are a lot of things that I'm not sure how to manipulate, such as
> the various rates that are usually drawn off the USRP, but in this case
> don't necessarily apply because the samples are coming from a file? Maybe
> they should just be set artificially to sort of trick the computer into
> thinking that the samples ARe coming from a USRP?
You're on the right track--continue to use gr.file_source. You'll
need to comment out all the lines that try to set frequency, gain,
etc. You can put them in a Python 'if' block and either run all the
commands for the USRP, or just create the file source.
The data is pulled from the file as fast as the computer can read the
disk. If you want to play it back at a certain rate in wall clock
time, you can insert a gr.throttle(itemsize, sample_rate) block in the