Sunday, October 14, 2012

Using File source & File sinks in GNU Radio

Source
Usage:

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




http://gnuradio.org/doc/doxygen/gr__types_8h_source.html

http://gnuradio.org/doc/doxygen/gr__complex_8h_source.html


Example:

    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.

Example:

    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.

Sink
Usage:

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

Example:

    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 : http://www.swigerco.com/gnuradio/file_io.html


No comments:

Post a Comment