speech processing for your voice in Matlab

조회 수: 8 (최근 30일)
Liyan
Liyan 2023년 9월 6일
답변: Pooja Kumari 2023년 9월 20일
myvoice=audiorecorder
disp('Start Recording')
recordblocking(myvoice,10)
disp('End of Recording')
play(myvoice)
y=getaudiodata(myvoice);
plot(y)
  댓글 수: 1
Image Analyst
Image Analyst 2023년 9월 6일
If you have any more questions, then ask them, and attach your data and code to read it in with the paperclip icon after you read this:

댓글을 달려면 로그인하십시오.

답변 (1개)

Pooja Kumari
Pooja Kumari 2023년 9월 20일
Dear Liyan,
It is my understanding that you are facing issue with processing the voice and plotting the audio signal in time and frequency domain in MATLAB.
“audiorecorder” object with “SampleRate” property can be used to store Sampling Frequency i.e., “Fs”. You can refer to the below documentation for more information on “audiorecorder” function:
For converting the time domain audio signal to frequency domain, “fft”(fast fourier transform) function can be used. You can refer to the below document for more information on “fft” function:
Below is the code for your reference:
myvoice = audiorecorder; % "audiorecorder" function is used to record audio data from an input device
recDuration = 10; %time duration is taken as 10 sec
disp('Start Recording')
recordblocking(myvoice,10)
disp('End of Recording')
play(myvoice)
% Get the recorded data
y = getaudiodata(myvoice); %getting the data from recorded sound
Fs = myvoice.SampleRate; % Sample rate
X = fft(y);
f = linspace(0,Fs/2,length(y)/2+1); %Using Nyquist Sampling theorem
X = 20*log10(abs(X(1:length(y)/2+1))); % converting time domain to frequency domain with dB scale.
% Plot the recorded waveform in time domain
t = (0:length(y)-1)/fs;
subplot(2,1,1);
plot(t, y);
xlabel('Time (s)');
ylabel('Amplitude');
title('Time-domain Signal');
% Plotting the frequency-domain spectrum
subplot(2,1,2);
plot(f, X);
xlabel('Frequency (Hz)');
ylabel('Magnitude (dB)');
title('Frequency-domain Spectrum');
I hope this helps!

카테고리

Help CenterFile Exchange에서 Measurements and Spatial Audio에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by