1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
|
function dtmf
ref=[1209 1336 1477 1633; 697 770 852 941];
s=['123A';'456B';'789C';'*0#D'];
figure('userdata',ref);
for i=1:4
for j=1:4
uicontrol('Style','pushbutton','position',[100+50*j 250-50*i 50 50],...
'String',s(i,j),'FontSize',10,'callback',@son,...
'userdata',[i j]);
end
end
uicontrol('Style','text','position',[350 150 100 50],...
'String','5 sec','FontSize',10);
uicontrol('Style','pushbutton','position',[350 150 100 50],...
'String','Enregistrer','FontSize',10,'callback',@enregistrer);
uicontrol('Style','pushbutton','position',[350 100 50 50],...
'String','Robot','FontSize',10,'callback',@robot);
uicontrol('Style','pushbutton','position',[400 100 50 50],...
'String','Echo','FontSize',10,'callback',@echo);
uicontrol('Style','pushbutton','position',[350 50 50 50],...
'String','Grave','FontSize',10,'callback',@grave);
uicontrol('Style','pushbutton','position',[400 50 50 50],...
'String','Aigue','FontSize',10,'callback',@aigue);
function son(obj,event)
x=get(obj,'userdata');
ref=get(gcf,'userdata');
t=0:1/8000:.1;
v=sin(2*pi*ref(1,x(1))*t)+sin(2*pi*ref(2,x(2))*t);
wavplay(v,8000);
function enregistrer
Fe = 8000;
parole = wavrecord(5*Fe,Fe,'int16');
wavwrite(parole,'voix.wav');
function robot
a1=0.6;
a2=0.4;
a3=0.2;
a4=0.1;
a5=0.7;
a6=0.6;
a7=0.8;
R1=700;
R2=900;
R3=600;
R4=400;
R5=450;
R6=390;
[d,r]=wavread('parole.wav');
num1=[0,zeros(1,R1-1),1];
den1=[1,zeros(1,R1-1),-a1];
d1=filter(num1,den1,d);
num2=[0,zeros(1,R2-1),1];
den2=[1,zeros(1,R2-1),-a2];
d2=filter(num2,den2,d);
num3=[0,zeros(1,R3-1),1];
den3=[1,zeros(1,R3-1),-a3];
d3=filter(num3,den3,d);
num4=[0,zeros(1,R4-1),1];
den4=[1,zeros(1,R4-1),-a4];
d4=filter(num4,den4,d);
dIIR=d1+d2+d3+d4;
num5=[a5,zeros(1,R5-1),1];
den5=[1,zeros(1,R5-1),a5];
dALL1=filter(num5,den5,dIIR);
num5=[a6,zeros(1,R6-1),1];
den5=[1,zeros(1,R6-1),a6];
dALL2=filter(num5,den5,dALL1);
dTOTAL=d+a7*dALL2;
soundsc(dTOTAL,r);
wavwrite(dTOTAL,'robot.wav');
function echo
[d,r,n]=wavread('voix.wav');
num=[0,zeros(1,2900),1];
den=[1,zeros(1,2900),-0.8];
d1=filter(num,den,d);
soundsc(d1,r);
wavwrite(d1,r,n,'echo.wav');
function grave
[x,fe]=wavread('voix.wav');
Wn = .20;
N = 62;
gLP = 0.4;%Le gain du filtre passe bas
LP = fir1(N,Wn);
Wn1 = [.20, .50];
y1 = conv(LP,x);
yG= gLP * y1;
soundsc(yG,fe);
wavwrite(yG,fe,'aigue.wav');
function aigue
[x,fe]=wavread('voix.wav');
Wn = .50;
N = 62;
gHP = 1.5; %Le gain du filtre passe haut
HP = fir1(N,Wn,'high');
y2 = conv(HP,x);
yA= gHP * y2;
soundsc(yA,fe);
wavwrite(yA,fe,'aigu.wav'); |
Partager