Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Decoding AM station from SDR into sound?

  1. Sep 7, 2014 #1
    In short, how do you decode AM signal from I/Q samples into sound?

    In details, i made a software defined radio that uses a PC sound card as ADC.
    The local oscillator on it is set to 700KHz, there is a radio station at 731KHz.
    With existing software i verified that the hardware works - the station is here and i can hear it.

    Now, the goal is to make my own SDR software.
    I can read the I/Q signals, at 96K samples per second, into a program on a PC.
    When i do FFT on them, i see the target station at 31KHz in there.

    And that's where i ran out of knowledge.
    There is a lot of info on the net on how to make SDR hardware, but i wasn't able to find anything on how to make SDR software.

    So, i have two sets of numbers that are I/Q samples, 96000 of them per second, and a frequency of the station.

    How do i get sound out of them?
    Where to begin, what names to google for, what to read?
  2. jcsd
  3. Sep 9, 2014 #2
    Figured it out.
    Two ways to do it, good and bad.

    1. The bad. Produce the sound as beat frequency of the carrier. Sound sample = input sample (as a complex number I,Q) multiplied by sin(wt)+i*cos(wt), where w is 2*PI*Fcarrier.
    This results in a sound, but the sound is quite bad.
    Also, you need to pick the frequency exactly, or the sound will overlap with noise and shifted carrier.
    Only advantage is - it's simple to implement.
    Might be useful for some other signal type, but not quite good enough for AM audio.

    2. The good. Apply a band pass filter to the target's frequency (i.e. carrier+-4KHz). Now, the sound is the complex magnitude of the input sample - the envelope of the AM signal.
    This gives clear audio.
    The trick is to get a good enough band-pass filter, and these are two orders of magnitude harder to implement than both the first method and the rest of the receiver program combined.
    I ended up using Butterworth IIR filter, for which there is good info on http://www-users.cs.york.ac.uk/~fisher/mkfilter .

    In both cases it's a good idea to apply even simple low-pass and high-pass filters to the audio, to get rid of stuff at the edges.

    Things to look for and google:
    -DSP, digital signal processing
    -C Algorithms For Real Time DsP, by Paul Embree, a book.

    Perhaps this is better moved to Math section?
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook