No BSD License  

Highlights from
Alien Voices using the Texas Instruments C5000 and C6000 DSP

Alien Voices using the Texas Instruments C5000 and C6000 DSP

by

 

27 Aug 2003 (Updated )

Simple DSP using ring modulation to generate sum and difference frequencies as used in alien voices.

alien_voices_10.m
% alien_voices_10.m
% by Richard Sikora 23 August 2003.

% To show the effect of ring modulation, that is to multiply a 
% sinusoidal input + second harmonic by a sinusoidal modulation 
% frequency to provide sum and difference frequencies.

% To experiment with ring modulation, change the two frequencies below
% The two frequencies when added together should not exceed 5000.

input_frequency = 500;
modulation_frequency = 50;

t = 0: 0.0001: 0.1;  % Time range. Step size affects frequency range

N = (0.1/0.0001)+1; % Calculate size of time array

% Multiply each value in input_frequency array by modulation_frequency 
% For better resolution on the display, the each frequency has been divided by 10
for i = 1 : N
  input(i) = sin( 2 * pi * input_frequency/10 * t(i) ) ;
  % Add a second harmonic to the input
  input(i) = input(i) + 0.7 * sin( 2 * pi * 2 * input_frequency/10 * t(i) ) ;
  modulation(i) = sin ( 2 * pi * modulation_frequency/10 * t(i));
  y(i) = input(i) * modulation(i);
end    

% Plot modulated frequency on top pane

subplot(2,1,1);
plot ( t, y ), grid on
xlabel ('Time in ms');
ylabel ('Magnitude');
title ('500 Hz + 2nd Harmonic Modulated by 50 Hz');
set (gca, 'xlim', [0, 0.1])
set (gca, 'XTickLabel', [0 2 4 6 8 10])
set (gca, 'ylim', [-1.5, 1.5])

% Multiply each value in input_frequency array by modulation_frequency 
% This time the input frequency is not divided by 10.
for i = 1 : N
  input(i) = sin( 2 * pi * input_frequency * t(i) ) ;
  % Add a second harmonic to the input
  input(i) = input(i) + 0.7 * sin( 2 * pi * 2 * input_frequency * t(i) ) ;
  modulation(i) = sin ( 2 * pi * modulation_frequency * t(i));
  y(i) = input(i) * modulation(i);
end   

% Perform 1024 Point FFT on modulated signal y
Y = fft( y,1024);

% Calculate power in signal
Pyy = Y.* conj(Y)/1024;

% Scale frequency range for frequency f
f = 10000 * (0:512)/1024;

% Plot output of FFT on second pane
subplot(2,1,2);
plot ( f, Pyy(1:513));
xlabel ('Frequency');
ylabel ('Power');
title ('Frequency Spectrum of Modulated Signal using FFT');
set (gca, 'xlim', [0, 2000])
set (gca, 'XTick', [0, 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000])
set (gca, 'ylim', [0, 100])

Contact us