(Replacing page with 'Question 1: MATLAB code: Media:Example.ogg Sound file: Media:Example.ogg')
Line 1: Line 1:
% Question 1
+
Question 1:  
function[] = question1()
+
MATLAB code: [[Media:Example.ogg]]
N1 = sin(2*pi*391.995436*[0:0.0001:1]);        %G quarter note
+
Sound file: [[Media:Example.ogg]]
N2 = sin(2*pi*466.1637615*[0:0.0001:1]);        %Bflat quarter
+
N3 = sin(2*pi*523.2511306*[0:0.0001:1.5]);      %C dotted quarter
+
N4 = sin(2*pi*391.995436*[0:0.0001:1]);        %G quarter
+
N5 = sin(2*pi*466.1637615*[0:0.0001:1]);        %Bflat quarter
+
N6 = sin(2*pi*554.3652618*[0:0.0001:0.5]);      %Csharp eigth
+
N7 = sin(2*pi*523.2511306*[0:0.0001:2]);        %C half
+
 
+
rest = [0:0.0001:2.5];                        %rest half and an eigth
+
 
+
%smoke on the water (part a):
+
tune = [N1 N2 N3 N4 N5 N6 N7 N1 N2 N3 N2 N1 rest];
+
 
+
newtune = [1:1:(length(tune)/2)];
+
% newtune(t) = tune(2t)
+
for i=1:(length(tune)/2)
+
    newtune(1,i) = tune(1,2*i);
+
end
+
 
+
%all three parts:
+
alltunes = [tune newtune newtune];
+
 
+
 
+
wavwrite(0.02*alltunes, 18667, 'question1.wav');
+
 
+
 
+
1. Repeated phrase "number nine".
+
2. I don't hear anything in the reversed message.
+

Revision as of 18:53, 14 January 2011

Question 1: MATLAB code: Media:Example.ogg Sound file: Media:Example.ogg

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang