(Playing Music - MATLAB Code)
(Playing Music - MATLAB Code)
Line 2: Line 2:
 
   % Naman Chopra
 
   % Naman Chopra
 
   % ECE 301
 
   % ECE 301
 
 
 
   %Initializing
 
   %Initializing
 
   clear
 
   clear
 
   clc
 
   clc
 
 
   %Declarations
 
   %Declarations
 
   delta=0.00005;
 
   delta=0.00005;
Line 20: Line 17:
 
   Gb = 369.994;
 
   Gb = 369.994;
 
   G = 391.995;
 
   G = 391.995;
 
 
   %Hail Hail to Old Purdue
 
   %Hail Hail to Old Purdue
 
   songNotes = [A, B, Db, D, E, Gb, Gb, G, G, G, D, E, F, Gb ];
 
   songNotes = [A, B, Db, D, E, Gb, Gb, G, G, G, D, E, F, Gb ];
 
 
   t = 0:delta:finish;
 
   t = 0:delta:finish;
 
   for N = 1 : length(hail_hail)
 
   for N = 1 : length(hail_hail)
Line 29: Line 24:
 
     sound(song, 1/delta);
 
     sound(song, 1/delta);
 
   end
 
   end
 
 
   pause(1);
 
   pause(1);
 
 
   t = 0:delta:finish/2;
 
   t = 0:delta:finish/2;
 
   for T = 1 : length(hail_hail)
 
   for T = 1 : length(hail_hail)
Line 37: Line 30:
 
     sound(song, 1/delta);
 
     sound(song, 1/delta);
 
   end
 
   end
 
 
   pause(1);
 
   pause(1);
 
 
   t = 0:delta:finish;
 
   t = 0:delta:finish;
 
   for T = 1 : length(hail_hail)
 
   for T = 1 : length(hail_hail)

Revision as of 14:58, 4 September 2008

Playing Music - MATLAB Code

 % Naman Chopra
 % ECE 301
 %Initializing
 clear
 clc
 %Declarations
 delta=0.00005;
 finish=0.4
 durations = [ 3, 2, 2, 3, 1, 2, 2, 2, 1, 1, 2, 1, 1, 3];
 A = 220;
 B = 246.942;
 Db = 277.183;
 D = 293.665;
 E = 329.628;
 F = 349.228;
 Gb = 369.994;
 G = 391.995;
 %Hail Hail to Old Purdue
 songNotes = [A, B, Db, D, E, Gb, Gb, G, G, G, D, E, F, Gb ];
 t = 0:delta:finish;
 for N = 1 : length(hail_hail)
   song = sin(2 * pi * t * hail_hail(N));
   sound(song, 1/delta);
 end
 pause(1);
 t = 0:delta:finish/2;
 for T = 1 : length(hail_hail)
   song = sin(2 * pi * t * hail_hail(T));
   sound(song, 1/delta);
 end
 pause(1);
 t = 0:delta:finish;
 for T = 1 : length(hail_hail)
   song = sin(4 * pi * t * hail_hail(T));
   sound(song, 1/delta);
 end

Alumni Liaison

EISL lab graduate

Mu Qiao