diff extra codes/lab5.m @ 3:1c0f36c348d4

extra code for matlab
author Katerina <katkost@gmail.com>
date Sat, 20 Apr 2013 13:03:01 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/extra codes/lab5.m	Sat Apr 20 13:03:01 2013 +0100
@@ -0,0 +1,63 @@
+clear all
+%1.1
+%% Piano sound
+
+% hfile = '4192__RealRhodesSounds__D4.wav';
+% [x3, Fs3, nbits3, readinfo3] = wavread(hfile);
+% %sound(x3, Fs);
+% y = sinemodel_(x3, hamming(513)', 1024, 100,-35);
+% wavwrite(y, Fs3,'__RealRhodesSounds_D4.wav');
+
+
+%% 2.1 Compute the magnitude values on the to of the main lobe
+% loc=0;
+% mag=0;
+% 
+% binremainder = round(loc)-loc;
+% %Blackman-Harris 92dB
+% lb = [binremainder-4:binremainder+4]'; % main lobe (real value) bins to read
+% lmag = genbh92lobe(lb,1024)*10.^(mag/20); % lobe magnitudes
+% figure
+% plot(lmag);
+
+
+%% 2.2 Compute a spectrum of size N from a series of sinusoidal values
+
+% Y = genspecsines([10.3, 20.6, 30.9], [-10, -13, -16], [0, 0, 0], 1024);
+% 
+% %inverse fft
+% y=fftshift(real(ifft(Y)));
+% plot(y);
+% 
+% %the sinusoids 
+% Y1 = (-10)*exp(1*i);y1=ifft(Y1);
+% Y2 = (-13)*exp(1*i);y2=fftshift(real(ifft(Y2)));
+% Y3 = (-16)*exp(1*i);y3=fftshift(real(ifft(Y3)));
+% %add the sinusoids in the time domain
+% ytime = y1+y2+y3;
+% figure
+% plot(y1);
+
+%% Fugue
+
+% hfile = '22125__Connum__memento_to_Bachs_fugue_II.wav';
+% [x3, Fs3, nbits3, readinfo3] = wavread(hfile);
+% %sound(x3, Fs);
+% y = sinemodel(x3, hamming(2001)', 1024, -60);
+% wavwrite(y, Fs3,'fugue1.wav');
+
+% %% Soprano
+% 
+% hfile = '30084__HerbertBoland__FemalePhrase1.wav';
+% [x3, Fs3, nbits3, readinfo3] = wavread(hfile);
+% %sound(x3, Fs);
+% y = sinemodel(x3, hamming(2001), 1024, -50);
+% wavwrite(y, Fs3,'female1.wav');
+
+%% Soprano
+
+hfile = '32848__Quilt__Quilty_s_Old_School_Piano.wav';
+[x3, Fs3, nbits3, readinfo3] = wavread(hfile);
+%sound(x3, Fs);
+y = sinemodel_(x3, hamming(2001)', 1024, -50);
+wavwrite(y, Fs3,'piano1.wav');