Filter löschen
Filter löschen

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.

1 Ansicht (letzte 30 Tage)
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 Kommentare
Walter Roberson
Walter Roberson am 8 Dez. 2022
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
Jan am 8 Dez. 2022
Bearbeitet: Jan am 8 Dez. 2022
@Walter Roberson: Thanks for mentioning the former questions of kim.
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by