BStadlbauer
BStadlbauer

Reputation: 1285

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.

Upvotes: 0

Views: 1611

Answers (2)

Kevin Reid
Kevin Reid

Reputation: 43851

The most flexible method is to write your own GNU Radio block, but there are several options for getting data into a flow graph without using any custom blocks. (Naming from the Python perspective.)

  • gnuradio.blocks.message_source, which takes data from a gnuradio.gr.msg_queue.

  • You can use a gnuradio.blocks.file_descriptor_source where the file descriptor is one end of a pipe.

Upvotes: 0

Marcus Müller
Marcus Müller

Reputation: 36442

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!

Upvotes: 0

Related Questions