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.
Asked
Active
Viewed 1,332 times
2 Answers
0
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:
- make a new Out-of-tree module:
gr_modtool newmod sensorinterface
, change into the newly generated directory:cd gr-sensorinterface
- 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. - edit the generated source file (in
lib/
orpython/
, depending on which language you chose:- add a proper io signature: your output will probably have the size of
float
- edit the central
work
function; add code to get new samples, and copy those to theoutput_items
buffer.
- add a proper io signature: your output will probably have the size of
The guided tutorials are really nice!

Marcus Müller
- 34,677
- 4
- 53
- 94
-
Thanks a lot! Now that I can be sure that there is no block for this I will go trough the rest of the tutorial :-) – BStadlbauer Feb 15 '16 at 18:13
0
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 agnuradio.gr.msg_queue
.You can use a
gnuradio.blocks.file_descriptor_source
where the file descriptor is one end of a pipe.

Kevin Reid
- 37,492
- 13
- 80
- 108