Jump to content


Recreating an AM radio with a digital sound editor


1 reply to this topic

#1 CodeCat

    It's a trap!

  • Gold Member
  • 6111 posts

Posted 23 June 2006 - 12:05

I've always been very interested in how radio works. I did my final-year project of secondary school about the theory of radio, and in the first year of my physics course at university I built a simple AM radio receiver with a friend. So, I know the tricks involving radio, and I know how AM works pretty well.

To do part of this, you'll need to have a reasonably good sound editing program. I use GoldWave myself, it's shareware and can be downloaded online, here. Also, the sound files here are very large (3 MB or more), because they're made in WAV format at a 88200 Hz sampling rate. So you'll need a decent connection to download it, and your audio editor also has to be capable of editing files with such a sampling rate. Take that as an advance warning. :D

-----------------------------------------------------------------

So first, a little theory (technical, so skip this if you're really not interested).

AM stands for Amplitude Modulation, which means that the amplitude (or strength) of one signal is used to change the strength of another. In more mathematical terms, this means that the two signals are multiplied. Now, the interesting side of this is that, by multiplying the two signals, the frequency spectrum of the combined signal is totally different. You see, when you multiply to signals, the resulting signal contains 2 frequencies: the sum of the two original ones and the difference between the original ones. In practice, this means that by multiplying a wave by another, we can 'shift' it to a different frequency.

Here you can listen to several homemade samples of what amplitude modulation sounds like, when you multiply the sound by another wave of a fixed frequency. (excuse my taste in music :D ) You can clearly hear the wave get louder and softer at the lower modulating frequencies (up to 20 Hz). After that, the sounds starts to sound 'weirder' as the modulating frequency becomes higher. At about 500Hz you can begin to hear how the modulation 'shifts' all the frequencies in the original sounds upwards. At 10000Hz modulation (mind your ears!) the frequencies have been shifted so far upwards that you can't even recognise the song anymore.

This frequency shifting is exactly what AM radio does, except that the modulating frequency is much higher (150 kHz or more). An AM radio transmitter multiplies, or modulates, a regular sound signal with a much higher-frequency 'carrier' wave. This carrier wave has the frequency that you tune your radio to. The effect is that all of the frequencies that make up the sound get 'moved up' to the area around the frequency of the carrier wave. For example, a 1 kHz tone modulated onto a 1000 kHz carrier wave will be shifted to 1001 kHz (the sum) and 999 kHz (difference).

Here is an interesting little applet that you can use to see how it works: http://cnyack.homest...ation/modam.htm

So far so good. But of course we need a way to get it back 'down' to audible frequencies again when we receive it. This is called demodulation. There's several ways to do it, but the simplest way is called 'envelope detection'. An envelope detector is really simple, it only consists of 1 or 2 parts: a rectifier (which chops off the negative half of the signal, for example a diode) and a low-pass filter (takes out all higher frequencies and 'smoothes out' the wave).

-----------------------------------------------------------------

Now, on to the really interesting part. Here is a WAV file containing a 'radio station' transmitted at a frequency of 26 kHz. That's exceptionally low for an actual radio station, but we can't really go very high when we're limited to 44 kHz at most (half the sampling rate of the sound file). If you play the file you'll notice that you can't hear anything, but the volume meter will still go up and down. That's because there is sound being played, its frequency is just too high to be able to hear it (though any cats or dogs might!). Now, let's try and get the sound out of the file.

First, we have to rectify the sound by cutting off the bottom half of it. In GoldWave, click the 'Eval' button in the toolbar. This 'expression evaluator' is a very handy little feature of GoldWave, because it lets you mathematically select exactly what you want to do with a wave. To cut off the bottom half of a wave, fill in the following expression and click ok:
(wave(n)>0)*wave(n)

If you play the sound you might now hear something, but it won't sound great, with a lot of beeps and stuff in it. That's because we haven't done the second stage yet: filtering. A normal AM transmission only contains sound frequencies up to about 4-5 kHz at most, to conserve the amount of space a station takes up. I've done the same with my example, so we need to filter around there to get the best sound. In GoldWave, go to Effect in the menu, then Filter > Lowpass/Highpass. Select 'Lowpass', and for the cutoff frequency fill in 4000 Hz. The steepness controls how accurately it filters, but it doesn't really matter right now.

Now you'll be able to hear the sound (anyone recognise it?), but there's still a problem. First, all of the sound's 'energy' is still above the middle. A real sound is equally balanced between the top and the bottom half. To do this, we need to filter again, but this time, select 'Highpass' and fill in 20 Hz as the frequency. Set the steepness to 20 (the maximum). This will filter all very low frequencies out, and also moves the wave nicely into the middle of the screen. Now all we need to do is amplify the volume. To do this, go to Effect > Volume > Maximize Volume, then click OK immediately. The sound will now be amplified to its maximum strength.

You'll notice that it sounds a lot like a real AM radio, except with none of the noise or weird effects that you'd normally get. That's of course because we're not working in the 'real world' here but in a closed noise-free environment. Congratulations, you've just digitally recreated an AM receiver!

I might write more later, cause this is really just the tip of the iceberg. Time will tell... :D
CodeCat

Posted Image
Posted Image

Go dtiomsaítear do chód gan earráidí, is go gcríochnaítear do chláir go réidh. -Old Irish proverb

#2 Ascendancy

    Needled 24/7

  • Member
  • 1293 posts

Posted 23 June 2006 - 19:00

Wow. Sounds like you put in a lot of time to do this. Sounds like a lot of fun though. :P
Posted Image
Thanks to that awesome signature maker, Cattman2236.
Posted Image
Posted Image



1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users