Is there a gnuradio module that uses a file as a source?

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?

Thanks
-Jonathan

On Fri, Aug 7, 2009 at 12:49, Jonathan C.[email protected]
wrote:

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
pipeline.

Johnathan

So, the program will run, but instead of hearing anything, I just get oX
over and over again.
http://gnuradio.org/trac/wiki/UsrpFAQ/Gen#OUuainoutput
It doesn’t look like a normal error, and doing a search, I haven’t seen
it
before.

./filesource_fmmod.py

gr_fir_ccf: using SSE
gr_fir_fff: using SSE
oXoXoXoXoXoXoXoXoXoXoXoXoXoX ad infinitum

Anyone know what’s up? I’ll keep taking a look (and try adding a
throttle,
for example). One possibility is that I had to manually set adc_rate, so
I
set it to 64000000 (since it should grab a value of 64MS/s from the
usrp, at
least according to the comment…and smaller values don’t seem to work,
so I
don’t know)

I’ve attached the changes I made… to make it easy to traverse, I
simply
commented out existing code with a ##

The code is usrp_wfm_rcv_nogui.py, modified to try and get a file
source. If
you have any idea what that error means, or maybe where the code goes
wrong,
your input would be appreciated (incidentally, what does the third value
in
gr.file_source modify? the boolean)

And a final question, when reading from a source obviously you don’t
have to
tune…but your samples were made over a given bandwidth, no? In my
case,
I’m using the TVRX, so about 6MHz. if I want to do FM demodulation, do I
have to do it over the baseband? Or can I still “tune”? Is it just a
matter
of shifting the baseband mathematically/

Thanks

PS if I can get this all working easily, would it be instructive to
include
a basic nogui example that runs based on a file? It seems decidedly
nontrivial.

2009/8/7 Johnathan C. [email protected]

It looks like I needed to change the decimation rate. Since cfile uses
16, I
tried 16 on the side of the demodulator (instead of 200, which is the
default), and it worked. Is this how it should be? One thing that does
happen is that it KILLS my computer’s processing, which I assume the
throttle should help? I did this

    self.connect (self.u, gr.throttle(gr.sizeof_gr_complex, 

64000000),
chan_filt, self.guts, self.volume_control, audio_sink)

But while it works, it still is a bit sluggish, and a bit off. Any
advice?

Sorry for the spam, it’s always nice to have realizations…

2009/8/7 Jonathan C. [email protected]

And it looks like by setting the throttling rate equal to the
adc_rate/decimation rate, I sample the file at the same rate the samples
were written,a nd everything works perfectly. If anyone has anything to
say,
though, I do appreciate it.

ON THAT FRONT, though, two things remain:

a) would it be useful for me to implement a basic, clean no gui that can
take a file as a source? It’s odd that it doesn’t exist as is…
b) Is there a way to shift the baseband of these samples? Given that
originally there was filtering done in the USRP and TVRX to get the 6MHz
bandwidth I’m using (including a heterdyne to cancel out the baseband),
I’m
not sure how I can go about shifting the center of the samples I have,
but
I’m sure it’s possible.

Thanks again
-Jonathan

2009/8/7 Jonathan C. [email protected]

Oops, it’s attached now

2009/8/7 Jonathan C. [email protected]

On Fri, Aug 07, 2009 at 06:52:41PM -0400, Jonathan C. wrote:

It looks like I needed to change the decimation rate. Since cfile uses 16, I
tried 16 on the side of the demodulator (instead of 200, which is the
default), and it worked. Is this how it should be? One thing that does
happen is that it KILLS my computer’s processing, which I assume the
throttle should help? I did this

    self.connect (self.u, gr.throttle(gr.sizeof_gr_complex, 64000000),

chan_filt, self.guts, self.volume_control, audio_sink)

But while it works, it still is a bit sluggish, and a bit off. Any advice?

If there’s a rate limiting block in the graph (e.g., usrp, audio) you
should not use a throttle block.

Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs