이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
Spech Recognation using Mfcc for Security
조회 수: 8 (최근 30일)
이전 댓글 표시
ANDI RiskiWijaya
2012년 9월 27일
|i have project. to make security sistem for home using mfcc method in MATLAB.. one voice (sample .wav) would become database...
this is my work.. please download and help to find the error.. thanks
댓글 수: 7
Daniel Shub
2012년 9월 27일
I am closing this question since it is a clear doit4me homework type problem. Please add what you have tried and where you are stuck.
ANDI RiskiWijaya
2012년 10월 4일
this is my work
clear;clc;close all; pc = 60; p=[0 0 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 1 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 0 0 0 1];
file1 = uigetfile ('*.wav'); % mengambil file wav [y1,x1] = wavread (file1); %sound(y1); % untuk membaca file wav
%Mengubah sinyal suara dalam sampling ke dalam domain waktu y11 = y1(1:12000,1) t1 = 0:length(y11)/x1:1; t1 = 0:1.5/length(y11)-1:1.5; t1 = 0:1.5/length(y11):1.5; t1 = t1(1,1:end-1);
%Perintah untuk desain filter BPF N=10;fs=24000;fp1=2000;fp2=10000; [b,a] =ellip(N,0.5,2,[fp1 fp2]/(fs/2)); [e,f]=freqz(b,a,1024);
%perintah untuk memfilter sinyal suara z1 = filter(b,a,y11);
% set parameter decimate n = 10; %hanya diambil 1/10 sampel
% Hitung decimate g1 = decimate(z1,n);
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Untuk menampilkan magnitude tiap inputan display (y11); % input1 = amplitude %untuk menampilkan gambar sinyal suara figure subplot (2,1,1);plot(t1,y11); title('Bentuk Sinyal suara dengan Fs 9500Hz'); xlabel('Time (sec)'); ylabel('Amplitude');grid on subplot (2,1,2); plot(y11);title('Bentuk Sinyal suara dengan Fs 9500Hz'); xlabel('sample'); ylabel('Amplitude');grid on %perintah untuk menampilkan gambar filter figure plot(f/pi*(fs/2),abs(e)); title ('Band Pass Filter');grid %perintah menampilkan sinyal hsil filter figure plot (z1); title ('Sinyal suara setelah di filter');grid xlabel('sample');ylabel('Amplitude') %Tampilkan sinyal hasil BPF kontinu, diskrit, dan hasil decimate figure subplot (2,1,1); stem(g1); title('Decimated Signal1');grid xlabel('sample');ylabel('Amplitude'); subplot (2,1,2); plot(g1); title('Decimated Signal1');grid xlabel('sample');ylabel('Amplitude'); figure stem(z1);xlabel('sample');ylabel('Amplitude');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Ambil input dari hasil desimasi in1=g1; alpha=1/sqrt(2); z=1;i=1;m=1;k=1;l=1;
% Hitung ekstraksi ciri berdasarkan rumus MFCC for ii = 1:size(Letters,2); for jj = 1:size(Users,2); for kk = 1:NoOfSamples file_name = strcat(Users(jj),'_',Letters(ii),int2str(kk)); Samples = eval(char(file_name)); zz = find(Samples) < max(Samples/3);%Threshold speech regions Samples(zz) = 0; zz = find(Samples); Speech_Region = Samples(zz)/norm(Samples(zz)); WindowSize = floor((size(Speech_Region,1))/(NoOfWindows+1)); ww = 0; for ll = 0:OverlapSize:(NoOfWindows-1)/2 bb = Speech_Region(floor(ll*WindowSize)+1:floor(ll*WindowSize)+WindowSize).*hamming(WindowSize); fb = fft(bb); mb = 1000 * log10(1 + fb./8000); mfout = dct(log(abs(mb)),NoOfFilters); MFCC(ii,kk,ww*NoOfFilters+1:ww*NoOfFilters+NoOfFilters) = mfout; ww = ww + 1; end end end end
%% Perform Gaussian Modelling for MFCC Windows = size(mfcc,3); tempStorage = zeros(size(Users,2)*NoOfSamples,Windows); tempStorage(:,:) = mfcc(1,:,:); obj_A = gmdistribution.fit(tempStorage,1,'Regularize',0.01); tempStorage(:,:) = mfcc(2,:,:); obj_B = gmdistribution.fit(tempStorage,1,'Regularize',0.01); tempStorage(:,:) = mfcc(3,:,:); obj_C = gmdistribution.fit(tempStorage,1,'Regularize',0.01); tempStorage(:,:) = mfcc(4,:,:); obj_Five = gmdistribution.fit(tempStorage,1,'Regularize',0.01); tempStorage(:,:) = mfcc(5,:,:); obj_Point = gmdistribution.fit(tempStorage,1,'Regularize',0.01); tempStorage(:,:) = mfcc(6,:,:); obj_V = gmdistribution.fit(tempStorage,1,'Regularize',0.01);
for ii = 1:size(Letters,2); for jj = 1:size(Users,2); for kk = 1:NoOfTestSamples %% Extract MFCC for test data InputIn = strcat(Users(jj),'_',Letters(ii),int2str(kk)); Samples = eval(char(InputIn)); zz = find(Samples) < max(Samples/3);%Threshold speech regions Samples(zz) = 0; zz = find(Samples); Speech_Region = Samples(zz); mfcc_test = zeros(1,MFCCNo); WindowSize = floor((size(Speech_Region,1))/(NoOfWindows+1)); ww = 0; for ll = 0:OverlapSize:(NoOfWindows-1)/2 bb = Speech_Region(floor(ll*WindowSize)+1:floor(ll*WindowSize)+WindowSize).*hamming(WindowSize); fb = fft(bb); mb = 2595 * log10(1 + fb./700); mfout = dct(log(abs(mb)),NoOfFilters); mfcc_test(1,ww*NoOfFilters+1:ww*NoOfFilters+NoOfFilters) = mfout; ww = ww + 1; end %% Classify MFCC test data on Mahanalobis distance D1(1) = mahal(obj_A,mfcc_test); D1(2) = mahal(obj_B,mfcc_test); D1(3) = mahal(obj_C,mfcc_test); D1(4) = mahal(obj_Five,mfcc_test); D1(5) = mahal(obj_Point,mfcc_test); D1(6) = mahal(obj_V,mfcc_test); [m Ind] = min(D1); if(Ind == ii) MFCCCorrect_Test(jj,ii) = MFCCCorrect_Test(jj,ii) + 1; end end end end
% inisialisasi output sebagai vector ciri
vektorciri=outfil6;
% plot vector ciri figure plot (vektorciri); title ('Vektor ciri Suara'); hold off xlabel('vektor ciri ke-n');ylabel('ekstraksi ciri')
%program normalisasi dan pengkodean %normalisasi vektorciri v1=max(vektorciri); vektorciri=vektorciri./v1 for i=1:24 if vektorciri(i)>0.49 vektorciri(i)=1 else vektorciri(i)=0 end end disp(vektorciri);
% Nilai fitnes for i=1:25 nilaifitnes1=0; for j=1:24 if vektorciri(j)== p(i,j) nilaifitnes1=nilaifitnes1+1; end end nilaifitnes(i)=nilaifitnes1/24*100; end
bestfitnes=max(nilaifitnes);
generate=0;
%kriteria terministik disp(nilaifitnes); %probabilitas kumuatif totalfitnes=0;
for i=1:25 totalfitnes=nilaifitnes(i)+totalfitnes; end
probabilitaskumulatif(25)=0;
probabilitaskumulatif(1)=(nilaifitnes(1)*100/totalfitnes); for j=2:25 probabilitaskumulatif(j)=(nilaifitnes(j)*100/totalfitnes) + probabilitaskumulatif(j-1); end disp(probabilitaskumulatif);
while ( bestfitnes < 98 )&( generate < 10000 )
%Fungsi seleksi for o=1:30; putar=randperm(100); seleksi=putar(1); seleksi=seleksi+probabilitaskumulatif(1); t=0; for t=1:25; if probabilitaskumulatif(t) <= seleksi for k=1:29; induk(o,k)=p(t,k); end end end end
%susun induk u=0; for i=1:30 if induk(i,25)==1; u=u+1; for l=1:29 induk1(u,l)=induk(i,l); end end end for i=1:30 if induk(i,26)==1; u=u+1; for l=1:29 induk1(u,l)=induk(i,l); end end end
for i=1:30 if induk(i,27)==1; u=u+1; for l=1:29 induk1(u,l)=induk(i,l); end end end
for i=1:30 if induk(i,28)==1; u=u+1; for l=1:29 induk1(u,l)=induk(i,l); end end end
for i=1:30 if induk(i,29)==1; u=u+1; for l=1:29 induk1(u,l)=induk(i,l); end end end
%cross over for i=1:29 a=randperm(100); probabilitascrossover=a(50); if probabilitascrossover < pc b=randperm(29); titik=b(14); for k=1:titik offspring(i,k)=induk1(i+1,k); offspring(i+1,k)=induk1(i,k); end
for k=titik:29
offspring(i+1,k)=induk1(i+1,k);
offspring(i,k)=induk1(i,k);
end
else
for k=1:29
offspring(i,k)=induk1(i,k);
offspring(i+1,k)=induk1(i+1,k);
end
end
i=i+2;
end
for i=1:30 nilaifitnes1=0; for j=1:24 if vektorciri(j)== offspring(i,j) nilaifitnes1=nilaifitnes1+1; end end nilaifitnes(i)=nilaifitnes1/24*100; end bestfitnes=max(nilaifitnes); generate=generate+1; end
Walter Roberson
2012년 10월 4일
Walter Roberson
2012년 10월 4일
A sample input .wav file might turn out to be useful to us, but not until the code is formatted to be readable.
Walter Roberson
2012년 10월 4일
In particular, you need to describe what error message you are encountering and show the traceback.
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
