Effacer les filtres
Effacer les filtres

Record and save audio with your specific file name for the audio.

5 vues (au cours des 30 derniers jours)
kim
kim le 3 Déc 2022
Commenté : Walter Roberson le 4 Déc 2022
I want to record and save an audio with my specific filename.wav file and then to test it when it match my voice with that file or not. please help me. this is my code.
clc
clear all
close all
warning off
Fs=8000;%Sampling frequency in hertz
ch=1;%Number of channels--2 options--1 (mono) or 2 (stereo)
datatype='uint8';
nbits=16;%8,16,or 24
Nseconds=5;
% to record audio data from an input device ...
...such as a microphone for processing in MATLAB
recorder=audiorecorder(Fs,nbits,ch);
disp('Start speaking..')
%Record audio to audiorecorder object,...
...hold control until recording completes
recordblocking(recorder,Nseconds);
disp('End of Recording.');
%Store recorded audio signal in numeric array
x=getaudiodata(recorder,datatype);
%Write audio file
audiowrite('test.wav',x,Fs);
  3 commentaires
kim
kim le 4 Déc 2022
Modifié(e) : kim le 4 Déc 2022
yes please help me . I want to create a real time audio and name it by myself I dont want the test.wav to be a named. like when youre entering a voice activation your voice will verify it according to the audio. and then it will say access granted or denied sorry for my bad english. @Walter Roberson
kim
kim le 4 Déc 2022
Iam creating a voice recognition that will allow user to register and save his/her audio to the database and when he/she log in or speak it will detect that its from his/her and it will access granted. what should I write with that instead?

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 4 Déc 2022
To allow the user to create the file name use uiputfile
[filename, pathname] = uiputfile('*.wav', 'File name for output');
if isnumeric(filename); return; end %user cancel
fullname = fullfile(pathname, filename);
audiowrite(fullname, x, Fs)
There are a number of posts talking about Voice Recognition; see https://www.mathworks.com/matlabcentral/answers/?term=tag%3A%22voice+recognition%22
Note: some of those posts are actually about Speech Recognition rather than Voice Recognition. Voice Recognition is when you are trying to identify who is speaking. Speech Recognition is when you are trying to identify what they are saying.
  1 commentaire
Walter Roberson
Walter Roberson le 4 Déc 2022
Replace
audiowrite('test.wav',x,Fs);
with
[filename, pathname] = uiputfile('*.wav', 'File name for output');
if isnumeric(filename); return; end %user cancel
fullname = fullfile(pathname, filename);
audiowrite(fullname, x, Fs)

Connectez-vous pour commenter.

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by