Midterm: AM Stereo

Overview

Last lab we looked at the commercial FM signal. FM has slowly but consistently increased market share over AM. One of the reasons is the FM is stereo. FM stereo was introduced as a compatible variant of mono FM. Several different systems have been proposed for a compatible AM stereo system. One early system transmitted two different channels on two different stations. However, we'd like a system that is compatible with current systems, while encoding the stereo signal in the same bandwidth.

Aims of the Midterm

The aim of the lab is to design a system for transmitting and receiving stereo signals over AM. There are lots of different options. Last time this class was offered , we looked at one of the options that was actually commercialized, and is still widely used in several different countries. This time will look at a different, similar alternative, that is more robust and easily implemented.

Stereo AM was ultimately not successful in the U.S. The FCC initially specified a standard, and then, under pressure, unspecified the standard so that the market could decide among many competing approaches. Consumers were confused, no system won in the marketplace, and AM stereo faded away. Canada and Australia did choose standards, and AM stereo is much more successful in these countries. These are also large countries, where AM's propagation characteristics are a significant benefit over FM.

Generation of Test Signals

Before we get started we need a signal we can use to test whether a stereo transmission system is working. For convenience, we are going to use a test signal that has a 350 Hz tone in one channel, and 440 Hz tone in the other channel. These two together give you the characteristic dial tone sound. If you hear a pure tone in each channel, you know the two are separated. If you hear the dial tone, you are hearing both frequencies together. This makes it easy to hear if there is any crosstalk between the two channels.

We'll use 5 seconds of data, sampled at 10 kHz, which corresponds to the AM channel bandwidth.

>> fsb = 1e4;			# Sampling Frequency
>> tb = [1:(5*fsb)]/fsb;	# Sample times at baseband (10 kHz)
>> dl = cos(2*pi*440*tb);	# left channel
>> dr = cos(2*pi*350*tb);	# right channel
>> sound(dl,1e4);		# higher pitch left channel
>> sound(dr,1e4);		# lower pitch right channel
>> sound((dl+dr)/2,1e4);	# dial tone sound.


Make sure these sound right to you.

AM Stereo C-QUAM Idea

The system that ultimately was chosen in the U.S., and failed in the marketplace, was C-QUAM, which stands for Compatible-Quadrature Amplitude Modulation. The basic idea is to transmit the Left+Right channel using conventional AM modulation, and then send the stereo Left-Right information using narrowband FM modulation of the AM carrier. A conventional AM receiver will decode the magnitude of the signal, and will properly receive the L+R channel. An FM radio would only hear the Left-Right channel. If we decode both, we can combine the two to recover the Left and Right channels separately, which is the goal.

AM Stereo SSB Alternative

However, a simpler alternative is to simply transmit the left channel in the lower SSB sideband, and the right channel in the upper SSB sideband. This eliminates the need to accurately balance the two channels. The issue is whether this can be made to be compatible with conventional commercial AM receivers.

Transmitter

The transmitter needs to generate the AM stereo waveform and modulate it to a carrier frequency. If and are the real signals to send to the left and right channels, the signal we need to generate is

where is a lower sideband SSB filter, and is an upper sideband filter.

A block diagram for one implementation looks like this

We send the left channel using the lower SSB sideband and the right channel with the upper SSB sideband. These two signals are added, then modulated to the carrier frequency . For now, set , and assume that and are less than 1.

The first task of the midterm is to generate at baseband. The signals and are real, and we'll assume they have a bandwidth of 10 kHz.

The spectrum of the baseband signal will look like this

We need the single sideband filters to make this work. These can be computed analytically. The spectrum for the upper sideband filter looks like this:

where is the sampling frequency. This is a rect function centered at , of width . This has an impulse response

where is the sampling time, and we are neglecting scale factors. Since the signal is sampled, we only need the values at ,

Dividing out ,

and then replacing with ,

This can be simplified further, but this will do for our purposes. Note that this is a function only of .

In practice, we need to terminate this filter at some point. Assume we have an 81 sample filter (-40<n<40), and that we use a window function to eliminate Gibbs ringing. In this case we use matlab's chebwin(), but almost any other window would do. We can calculate the filter and its frequency response with

>> % compute the filter
>> n = [-40:40];
>> Calculate filter, noting that matlab's sinc includes the \pi factor, so we leave it out here
>> hU = (i.^n.*sinc(n/2)).*chebwin(length(n))';
>> % plot its impulse response,
>> stem(real(hU));
>> hold
>> stem(imag(hU),'--')
>> hold
>> % Plot the frequency response
>> %   normalized frequencies
>> fn = [-255:256]/512;
>> %   zero pad to 512 samples to make a nice looking plot
>> HU = fftshift(fft(fftshift([hU zeros(1,512-length(hU))])));
>> plot(fn, abs(HU))


The result should be an impulse response that looks like this, where there is one real component at DC, and the rest are imaginary and antisymmetric

and a frequency response that looks like

You will also need the LSB filter, which you can derive easily using the Fourier transform theorems.

Make an m-file that generates the complex baseband signal, using the matlab m-file with the call

function [ rb ] = ams_xmit_bb(ml, mr,tb,fsb,k)
%ams_xmit_bb( ml,mr,tb,fsb ,fc,ka,kf)
%   baseband AM stereo encoder
%       ml -- left channel
%       mr -- right channel
%       tb -- time of baseband samples
%       fsb -- sampling frequency
%       k  -- scale  factor


If you run this with the following parameters

> rb = ams_xmit_bb(dl,dr,tb,fsb,0.25);
> plot(rb(1:1000))


you should get a plot that looks like

This is plotting the real part of the signal against the imaginary part.

Once we have this, we can modulate up to the RF frequency fc. In order to keep things simple, we will set the RF frequency to 25 kHz sampled at 100 kHz. You can think of this as an intermediate frequency (if), which we can then modulate up to any frequency we like, as we talked about in class. Then

> fsrf = 1e5;				# Sampling Frequency at RF (100 kHz)
> trf = [1:(5*fsrf)]/fsrf;		# Sample times at RF (5 seconds 100 kHz)
> efc = exp(i*2*pi*25e3*trf);		# Carrier frequency input to the second modulator


The output of the first modulator is at baseband, sampled at 10 kHz. Since the second modulator is at 100 kHz, we need to up-sample to 100 kHz, and then modulate. We can do this with

> rbu = interp(rb,10)			# take 10 kHz sampled signal, interpolate to 100kHz
> r = real(rbu.*efc);			# generate the RF signal modulated to 100 kHz


At this point we have the RF signal at of 25 kHz, sampled at 100 kHz. Another modulator could take us to any frequency we'd like.

Package up your transmitter with an m-file like this

function [ r ] = ams_mod(rb, tb, fsb, trf, fsrf, fc)
%ams_mod(r,tb,fsb,fc)
%   rb -- baseband signal
%   tb -- time of RF samples at baseband
%   fsb -- sampling rate at baseband
%   trf -- times of the samples at RF
%   fsrf -- sampling rate at RF
%   fc -- carrier frequency


This takes your baseband signal and modulates it on the carrier frequency .

Transmitter Testing

Take your AM receiver from lab 3, and modify it to use a single stage of decimation by a factor of 10. What happens if you apply your AM receiver to this signal? Does this make sense? What frequencies will you produce this way?

Given the transmit signal described above, design a receiver. Submit a block diagram of the receiver, implement it in matlab, and submit the matlab code. Test it as above, where the transmitter sends one frequency to the lower sideband channel, and one to the upper sideband channel. The matlab sound() function will play stereo given a matrix. Check to see that your receiver sends one frequency to the left channel, and one to the right. Make sure to normalize the sound signal so that its magnitude is less than one, so that the matlab sound routine will not clip the signal and produce distortion (that's why we scaled the transmit channels to 0.25).

The receiver will take the input signal, modulate it to baseband, and then use the SSB filters to separate the two channels. The nice thing about this approach is that we don't need to obsess about channel balance. All of the left channel is in the lower sideband, and all of the right channel is in the upper sideband. Approaches that use L+R and L-R require that the two channels be very accurately balanced in order to give a clean stereo effect.

Take the two tone dial tone stereo data, and run it through your receiver. Since hearing is logarithmic in sensitivity, you can easily hear even a 1% crosstalk. Is there any perceptible dial tone signal, or do you hear just the pure tones?

Next, try it with a stereo audio waveform. You can use a clip from your music collection, or find something on the web.

Most audio now is sampled at 44 kHz, while our AM radio system operates at 10 kHz. To convert the sampling rate of an audio file 'myaudio.wav’, load it into matlab, and resample it at 10 kHz with this

> s44 = audioread('myaudo.wav');
> s10 = resample(s44,10,44);


This upsamples by a factor of 10 to 440 kHz, and then downsamples by a factor of 44 to 10 kHz. s10 will be an Nx2 array, with each channel in a column. A sample data file containing 5 seconds of an ambient music clip from freesound.org is here:

Ambient Sound Clip at 10 kHz

The original source for this file is https://www.freesound.org/people/Erokia/sounds/391341 at 44 kHz.

Another one is

This has sounds of cash registers ping ponging between channels, also at 10 kHz.

A final interesting example from kosco.com is

This has a voice signal sequentially in the L, R, L+R, and L-R channels. This is also at 10 kHz. This is a good one to see what your receiver is really doing.

There are lots of other clips out there if you'd like to listen to something else. Look for files that have some significant stereo effect.

Finally, what happens if you demodulate at slightly the wrong frequency? How much frequency error can you tolerate before you get a noticeable effect?

As you saw (heard) above, if you use your conventional AM receiver, the sound quality is not very good. One approach for making a compatible signal for conventional AM radio is to add a carrier.

The block diagram now looks like this.

The spectrum of the baseband signal will look like this.

Modify your transmitter to include the carrier, and test to see if it works with your conventional AM receiver. Try different values of k. How big can k be for this to work acceptably?

Now, try your SSB based receiver on the same signals. Does this still work?

Lab Report

For you lab report, include your m-files for your

1. Baseband encoder ams_xmit_bb.m

2. RF modulator ams_mod.m

Include a .mat file with your original stereo sound clip, the baseband signal, and the stereo sound clip data after being sent through your system.

What output does the conventional AM receiver produce with the stereo input, and how does it work with this signal?

Finally, provide your assessment of the system.

1. Is it compatible with conventional AM receivers?

2. How does the system work with an incorrect frequency, and how much tolerance does it have?

3. What values of would you recommend?

That is it! I hope you found this interesting.