Line 1: Line 1:
im jack williams i like men
+
%Jack Williams
 +
%ECE 301, Mimi Boutin
 +
%HW 1
 +
%September 4, 2008
 +
 
 +
%PART A -------------------------------------------------
 +
 
 +
% Note Frequencies
 +
A  = 220;
 +
B  = 246.942;
 +
C  = 261.626;
 +
Db  = 277.183;
 +
D  = 293.665;
 +
Eb  = 311.127;
 +
E  = 329.628;
 +
F  = 349.228;
 +
Gb = 369.994;
 +
G  = 391.995;
 +
Ab  = 415.305;
 +
 
 +
%Note Vector
 +
NV = [A, B, Db, D, E, Gb, Gb, G, G, G, D, E, F, Gb];
 +
 
 +
%Time definition and Sampling Frequency
 +
delta = 0.00005;
 +
stop_time = 0.4;
 +
t = 0:delta:0.5;
 +
 
 +
%Sound Playing Loop
 +
for i = 1:1:length(NV)
 +
    signal = sin(2*pi * t * NV(i));
 +
    sound(signal, 1/delta);
 +
end
 +
 
 +
%PART B -------------------------------------------------
 +
 
 +
%stop_time cut in half
 +
stop_time = stop_time/2;
 +
t = 0:delta:stop_time;
 +
 
 +
%Sound Playing Loop
 +
for i = 1:1:length(NV)
 +
    signal = sin(2*pi * t * NV(i));
 +
    sound(signal, 1/delta);
 +
end
 +
 
 +
%PART C --------------------------------------------------
 +
 
 +
%stop_time Redifinition
 +
stop_time = 2*stop_time;
 +
t = 0 : delta : stop_time;
 +
 
 +
%Rescale from x(t) to x(2t)
 +
for i = 1:1:length(NV)
 +
  signal = sin(4*pi * t * NV(i));
 +
  sound(signal, 1/delta);
 +
end

Revision as of 11:48, 4 September 2008

%Jack Williams %ECE 301, Mimi Boutin %HW 1 %September 4, 2008

%PART A -------------------------------------------------

% Note Frequencies A = 220; B = 246.942; C = 261.626; Db = 277.183; D = 293.665; Eb = 311.127; E = 329.628; F = 349.228; Gb = 369.994; G = 391.995; Ab = 415.305;

%Note Vector NV = [A, B, Db, D, E, Gb, Gb, G, G, G, D, E, F, Gb];

%Time definition and Sampling Frequency delta = 0.00005; stop_time = 0.4; t = 0:delta:0.5;

%Sound Playing Loop for i = 1:1:length(NV)

   signal = sin(2*pi * t * NV(i));
   sound(signal, 1/delta);

end

%PART B -------------------------------------------------

%stop_time cut in half stop_time = stop_time/2; t = 0:delta:stop_time;

%Sound Playing Loop for i = 1:1:length(NV)

   signal = sin(2*pi * t * NV(i));
   sound(signal, 1/delta);

end

%PART C --------------------------------------------------

%stop_time Redifinition stop_time = 2*stop_time; t = 0 : delta : stop_time;

%Rescale from x(t) to x(2t) for i = 1:1:length(NV)

 signal = sin(4*pi * t * NV(i));
 sound(signal, 1/delta);

end

Alumni Liaison

Have a piece of advice for Purdue students? Share it through Rhea!

Alumni Liaison