Generating Stereo FM Signals, Thanks To Python

A casual understanding of how AM radio works is pretty easy to come by, and standard FM is only a little more complicated. Things can go off the tracks a bit with stereo FM, though — figuring out how they squeeze two separate audio tracks onto one radio signal is a bit of a head-scratcher. In that case, wrapping your head around the concept might be helped by mocking up a stereo FM signal with an arbitrary waveform generator and a little bit of Python.

Not that [Sebastian] of Baltic Lab was unfamiliar with multiplex FM theory, mind you. As he explains it, his goal was to generate a valid stereo FM signal with a different pure tone on each channel, 700 Hz on the left and 2,200 Hz on the right. Luckily, [Sebastian] has a nice AWG, the Siglent SDG1032X, which has an Ethernet connection that can be used to control it remotely along with PyVISA, a Python package for controlling instruments using the Virtual Instrument Software Architecture protocol.

The meat of this project, and what really helps drive home the concept of putting multiple audio signals onto an FM signal, lies in the Python code that generates the component parts. [Sebastian] does a great job explaining how he programatically generates the sum and difference signals along with the 19 kHz pilot tone, and puts them all together into one waveform. The output of the program is used to generate a series of values that are sent to the arbitrary waveform generator, which outputs the desired FM signal. Looking at the output on a spectrum analyzer, the two audio tones are clearly visible, as are the attenuated pilot tone and some other spikes a little further up.

Just add an antenna to the setup and you’d have the world’s dullest FM radio station — but at least it’d be in stereo. Or if you want to check out the origin story for FM radio, we’ve got something for that too.

7 thoughts on “Generating Stereo FM Signals, Thanks To Python

  1. The shame is that the AWG can’t stream samples over the network for buffering and playback. You’re limited to a tiny waveform memory, which is why this only works with pure tones rather than music programming or something.

  2. You know… It’s really not that hard to generate high fidelity stereo FM with a small handful of analog parts. You’ve got a mono signal (baseband) and a L-R single subcarrier with a suppressed carrier and 19 KHz pilot.

    1. Actually, it’s REALLY hard to generate a composite stereo signal that meets all the FCC requirements for frequency response, distortion, and channel separation over the entire audio spectrum. Phase errors are NOT you friend. I was involved with the design of the first commercial stereo generator which actually met those specs. It required some very sophisticated audio filters which took WAY more than a “handful of parts”.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.