I need help I'm trying to have an issue here like I want to detect that speaker and when it recognizes the voice it will say grant This is my code. In the testing part.
2 ビュー (過去 30 日間)
古いコメントを表示
clear,clc,close all
warning off;
% Parameters
Fs = 8000; % Sampling frequency
BtRt = 8;
T = 2; % Recording time
NumS = 5; % Number of samples for training
SDf = 10; % Standard deviation around frequency values
%% Recording user voice
USER = zeros(3*NumS,T*Fs); % Preallocation for recordings
% Record your voice for a second.
recObj = audiorecorder(Fs,BtRt,1);
disp('Get Ready')
pause(3)
disp('Say something on first')
recordblocking(recObj,T);
pause(1)
tmp = getaudiodata(recObj);
USER(3,:) = tmp';
pause(3)
disp('Say something on second')
recordblocking(recObj,T);
pause(1)
tmp = getaudiodata(recObj);
USER(3,:) = tmp';
pause(3)
disp('Say something on third')
recordblocking(recObj,T);
pause(1)
tmp = getaudiodata(recObj);
USER(3,:) = tmp';
% output of whether audio is granted or denied
disp(tmp)
if recObj==1
msgbox('Access Granted.')
% read file
y=audioread('Accessgranted.mp3')
% play soud file
sound(y,22050)
disp('Access Granted.')
end
if recObj==0
msgbox('Access Denied.')
% read file
y= audioread('Accessdenied.mp3')
sound(y,22050)
disp('Access Denied.')
end
14 件のコメント
Walter Roberson
2022 年 12 月 8 日
In another question, the user posted code that extracts pitch, and which compares that extracted pitch to a list of (at most) 5 stored pitches to find the closest stored pitch. But that code stopped short of checking how close the analyzed pitch is, and missed out on the idea that once you had identified which of the stored pitches was closest, that you could use the index to look up the name associated with that pitch.
Jan
2022 年 12 月 8 日
編集済み: Jan
2022 年 12 月 8 日
@Walter Roberson: Thanks for mentioning the former questions of kim.
@kim: You had a better version of the code 2 days ago: https://www.mathworks.com/matlabcentral/answers/1870557-i-need-help-im-trying-to-have-a-trouble-issue-here-like-i-dont-want-to-use-numbers-to-detect-that-sp#comment_2503742 . This was much better than the code you have posted today.
The online tutorial takes about 2 hours. It saves much more time than you waste by writing not working codes. Especially if you are a student and should implement a solution effciently, it is the best strategy to learn how to work with the selected tool.
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Speech Recognition についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!