HackRF Shell FM Receiver: Real Audio Output!

It has been a few months since the last report, but I have still been working on my Scheme FM receiver project here and there. With toddlers about, and other responsibilities, it can be hard to get in more than 30 minutes of work on it a week. Also, they are fond of pressing the computer reset button in the moments of my most intense concentration.

Several weeks were spent trying to figure out how to improve program performance, enough that I could actuallt process the data in real time. The main key there was understanding how to properly arrange the processing and the decimation, to reduce calculations required. But I learned a lot in the process about efficient use of Guile Scheme and C bindings — mainly figuring out different ways to reduce function calls, type checks, and type conversions.

After quite a lot of work creating bindings, I got the bandpass filter and the fm demodulation into the processing chain. However, the data being spit out after the demodulation was all garbage, though with some patterns here and there. It took many weeks of bug hunting and studying signal theory, to root out the errors, most of which were mishandling of data pointers, though there was also some fuzzyiness in my understanding of convolution, FIR filters, and FM demodulation that I had to work through.

I got through that, and was finally able to get some data out of the receiver that sounded like real FM radio sounds. However, the desired sounds were buried deeply in distortion and noise. With some further study, I realized that I needed another filter after the FM demodulation. That seems to be what they do in the GNU Radio WBFM block. Also, I learned that in real FM broadcast radio signals, there is a stereo channel (or rather, the L-R channel) inserted as side-bands around the mono channel (or rather, the L+R channel) so you have to filter that out (or do the additional stereo processing). I inserted another filter, in the process learning a bit about C macro procedures.

After this, I was able to receive understandable FM broadcast audio, from a local country/western station. However, the audio still has a noticeable amount of static. Adjusting the filter values does affect that, so I am in the process of trying out different values to see what works best. I think I also need to do something to reverse the high-frequency “pre-emphasis” which is used in FM broadcasting.