Sample size and data rates

Hi,

I have modified the usrp_wfm_rc.py script to capture samples of an FM
signal and write them to disk, and a second script to demodulate and
playback the samples.

The scripts are available here: http://rrsg.ee.uct.ac.za/members/aadil/

I have 3 questions:

  1. 1 000 000 samples writes a file 8 000 000 bytes (7.6Mb)
    This suggests each sample is 8bytes; 4bytes I and 4bytes Q.
    Is my assumption correct?
    Considering that the ADC produces 12bit samples, I would expect that
    each I and Q sample pair would be 4bytes. 2bytes I and 2bytes Q.
    Please can someone advise where i’ve missed some understanding.

  2. With reference to the above question, where can I find further
    details regarding the function of the gr.sizeof_item identifiers, in
    particular gr.sizeof_gr_complex.

3)If my file is 1 000 000 samples and my audio rate is 32KHz( I
understand this to be 32K samples/second) I expect my playback time to
be (1e6/32e3) = approx 30s, however when I play the file I get only
approx 3s playback time.
Im not sure where i’ve gone wrong.

Thanks for your time, and I look forward to and appreciate your advice.

Aadil

  1. 1 000 000 samples writes a file 8 000 000 bytes (7.6Mb)
    This suggests each sample is 8bytes; 4bytes I and 4bytes Q.
    Is my assumption correct?

This is how complex samples are represented in GNU Radio, as gr_complex
which is of type std::complex where I and Q are 4 bytes each, yes.

Considering that the ADC produces 12bit samples, I would expect that
each I and Q sample pair would be 4bytes. 2bytes I and 2bytes Q.
Please can someone advise where i’ve missed some understanding.

When the samples are generated in the USRP, they are packed (by default)
as 32-bit pairs, 16-bits for I and 16-bits for Q. This reduces the
amount of data across the bus rather than use full 32 bits for each.
You can set the format register to transfer 8-bit samples though.

Once these samples hit the host, GNU Radio extracts the samples in
whatever format they are and stores them as gr_complex. This simplifies
processing and makes everything standard. It also takes care of byte
ordering issues for you.

  1. With reference to the above question, where can I find further
    details regarding the function of the gr.sizeof_item identifiers, in
    particular gr.sizeof_gr_complex.

What I do is find where the types are defined, i.e.:
gnuradio-core/src/lib/runtime/gr_complex.h
typedef std::complex gr_complex;

  • George

Hi George,

Thank you for your response, you’ve cleared up some confusion on my
part.

Secondly Is anyone able to tell me where i’ve gone wrong with the
calculation I mentioned in my third question?

3)If my file is 1 000 000 samples and my audio rate is 32KHz (I
understand this to be 32K samples/second) I expect my playback time to
be (1e6/32e3) = approx 30s, however when I play the file I get only
approx 3s playback time.
Im not sure where i’ve gone wrong.

Thanks for your input, it’s much appreciated,

Aadil

Aadil V. schrieb am 2007-12-06 13:51:

Hi George,

Thank you for your response, you’ve cleared up some confusion on my part.

Secondly Is anyone able to tell me where i’ve gone wrong with the calculation I mentioned in my third question?

3)If my file is 1 000 000 samples and my audio rate is 32KHz (I
understand this to be 32K samples/second) I expect my playback time to
be (1e6/32e3) = approx 30s, however when I play the file I get only
approx 3s playback time.

Please be more specific. What do you mean by “play”? Do you play it to
the sound card? Can you post your relevant code? Can you give a link to
the very file?

Patrick

Engineers motto: cheap, good, fast: choose any two
Patrick S.
Student of Telematik, Techn. University Graz, Austria

Hi Patrick,

Thank you for replying my msg:

when I say “play” I mean outputting the file to the audio sink.

The scripts and sample file can be found here:
http://rrsg.ee.uct.ac.za/members/aadil/

I’ve realised my calculation does not make sense.
The 1 000 000 are written at quad rate of 320KSps which is approx
3secs worth of FM signal captured. Hence playback time (to audio sink)
is approx 3secs.

My question now is how is the file being further decimated, during the
demodulation and outputting to audio sink process.

The scripts and sample file can be found here:
http://rrsg.ee.uct.ac.za/members/aadil/

regards,

Aadil