[clug] Listening to digital radio with Open Source software

Paul Wayper paulway at mabula.net
Mon Aug 8 10:06:37 UTC 2016

```On 07/08/16 10:02, Mike Carden wrote:
> On Sat, Aug 6, 2016 at 8:48 PM, Stephen Hocking <stephen.hocking at gmail.com>
> wrote:
>
>> Thank you Mike - this has been one of the things I've been wanting to try
>> out. A lot of these devices can do FM as well, have you had a chance to try
>> that?
>>
>
>
> Sure. Listening to broadcast analogue FM is kind of the Hello World of SDR
> dongles.

Just for amusement, there's a simple reason why this is actually pretty
simple, but I'm going to tell the story in a round-about way.

I use LMMS (http://lmms.io) as a music synthesiser and sequencer.  Back when I
started using it the documentation was pretty awful, so I started writing it.
In documenting its standard synthesis instrument, the TripleOsc, I noted that
there are four modes of combining two oscillators - mixing, AM, FM and Phase
Modulation.  Why these four, I thought?  So I dug in the code to find out.

However, the answer can be deduced with a bit of mathematics.  We know that
mixing two signals together is just adding them.  And it doesn't take a lot of
thought to realise that amplitude modulation - where one signal changes the
amplitude of another - is multiplying the first by the second.  (In this
context, samples are processed as floating point numbers from -1 to +1, so the
result stays within that range.)  A bit of knowledge of the history of
analogue and digital synthesis provides the knowledge that frequency
modulation is equivalent to subtraction - by subtracting the carrier frequency
from the broadcast signal we get the original sound.

What's the final basic mathematical operation left?  That was the one that was
used for phase modulation!

Yes, phase modulation wasn't there because it made it sound interesting, or
because it was important, or because some particular instrument needed it,
it's there because why not :-)

So implementing analogue FM decoding in SDR is probably an exercise in how (or
where) to apply simple mathematics :-)

Have fun,

Paul

```