Drastically improve waterfall performance#7
Drastically improve waterfall performance#7kieransimkin wants to merge 1 commit intoadafruit:masterfrom
Conversation
set_at is extremely slow, plus we're doing a call to clamp() and color_func() once per pixel. This causes the waterfall to be a bit underwhelming. Using surfarray makes it quicker - I think you can probably do away with the pixel iterator completely and copy the entire row in one go (equivalent of a C memcpy())
|
Oh nice, yeah those look like some great optimizations for how it's manipulating the pygame surfaces. Let me setup a pi with it a little later this week to test it out and merge it in. Thanks for contributing! |
|
I was actually wondering if Adafruit would be interested in collaborating on a "RF Scanner" PI shield? I think, with Adafruit's purchasing power, it'd be possible to offer a Pi shield giving waterfall and spectrograph functionality way beyond what's capable with even $500 scanners, and to sell that for <$100 - the complete product assembled including a case would probably be saleable at around the $250 price point, would you agree with these guesstimates? Obviously there'd need to be some improvements to the software - the ability to decode FM/AM audio streams would be a must - this may not be possible from Python, but certainly would be from C. Scanning functionality (ie, the ability to sweep across the spectrum looking for signals) would also be a must, but I'm already planning on adding that to your Python code. I think there's a real opportunity here to produce a unique and highly desirable product - it's something I'm looking for myself and have yet to find. Would you raise this with your hardware team and see if they'd be interested in a collaboration? I could certainly design the hardware and write most of the software myself, but I'd need the backing or someone like Adafruit simply to source the RTL SDR chips at an affordable price - similarly, I don't have the purchasing power to get hold of a decent number of SPI TFTs - but Adafruit could do it ;) I think you'd probably want more than 320x240, ideally 800x600 or thereabouts. 3.2" / 4" would probably be the sweet spot in terms of physical screen size - people want a walkie-talkie sized device. Let me know what you think :) |
|
The closest thing I've come across is this: |
|
Fast forward four years... This is off-topic from the OP but I like the "Scanner Panadapter Pi Shield/bundle" idea. I've used an RTL to add a panoramic adapter to an old radio shack scanner by tapping the first IF following akdude47's example. I actually came here to grab this code so I can change from using GQRX software on a laptop to something more specific/stand-alone i.e. only the panadapter view on an RPI with a small TFT display, minus all the other stuff you see in GQRX or similar SDR applications. This would also open up the possibility of demod/decoding more than just FM/AM signals such as P25 trunk radio, DMR, and many other digital modes. The libraries exist to do most all of this already. Gqrx uses the open-source library gr-osmosdr Gnu Radio Blocks and has python support. Back to the OP, I noticed this never got merged. |
|
@kieransimkin the idea with the scanner sounds really great, i only have a pi 1.2 B+ but its worth a try. |
|
I am sure everyone has moved on but this PR would be very useful. It will not run. I am getting this error: I don't really understand what is going on here to fix it. |
|
Ah, it just needs to be commented out. |

set_at() is extremely slow, plus we're doing a call to clamp() and
color_func() once per pixel. This causes the waterfall to be a bit
underwhelming. Using surfarray makes it quicker - I think you can
probably do away with the pixel iterator completely and copy the entire
row in one go (equivalent of a C memcpy())