speech processing for your voice in Matlab
11 次查看(过去 30 天)
显示 更早的评论
myvoice=audiorecorder
disp('Start Recording')
recordblocking(myvoice,10)
disp('End of Recording')
play(myvoice)
y=getaudiodata(myvoice);
plot(y)
1 个评论
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
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!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Audio and Video Data 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!