Sunday, October 14, 2012

Using File source & File sinks in GNU Radio


src = gr.file_source ( type_t type, char *filename, bool repeat )

valid types are
  • gr.sizeof_char
  • gr.sizeof_double
  • gr.sizeof_float
  • gr.sizeof_gr_complex
  • gr.sizeof_int
  • gr.sizeof_short

The above are gnuradio customized data types which can be found in /usr/local/include/gnuradio
gr_types.h & gr_complex.h


    src = gr.file_source ( gr.sizeof_gr_complex, "/home/sumit/input_wave", 1)

Doing this a file source object src  is created which can then be connected to other object using connect method.

src will read a file named "input_wave" situated in /home/sumit as a complex signal and repeat it continuously.

For last parameter given as zero there wont be repeat of the data.


    disk_src = gr.file_source ( gr.sizeof_short, "/home/sumit/burst", 0)
reads a file named "burst" situated in /home/sumit  as short (2 byte) integers one time.


    dst = gr.file_sink ( type_t type, char *filename )


    sig_cap = gr.file_sink ( gr.sizeof_float, "/home/sumit/capture")
Creates and records to a floating point file named "capture" situated in /home/sumit/

Reference :

No comments:

Post a Comment