Search code examples
gnuradio

Gnuradio software source block


I'm currently trying to do some real-time signal-processing and I would like to use "gnuradio". I will be processing multiple channels of EEG which come in trough a custom interface (namely "Lab Streaming Layer"; LSL) in python. Now my question is if there is an existing block already where you can kind of "push" samples into the signal-processing-graph during run-time? The only blocks I've found so far offer support for audio hardware, TCP-streams and files.


Solution

  • You will have to write your own block; that can be done in Python or C++, whatever is better for your case.

    The GNU Radio Guided Tutorials (you should really read them in order from 1 to 5, at least) do explain how to do that.

    Because we all know that people are lazy at reading, here's a rough preview of what you'll learn:

    1. make a new Out-of-tree module: gr_modtool newmod sensorinterface, change into the newly generated directory: cd gr-sensorinterface
    2. add a new source block: gr_modtool add eeg_sensor_source; the block type you'll want is "source"; you will be asked to fill in some block details.
    3. edit the generated source file (in lib/ or python/, depending on which language you chose:
      1. add a proper io signature: your output will probably have the size of float
      2. edit the central work function; add code to get new samples, and copy those to the output_items buffer.

    The guided tutorials are really nice!