speech processing for your voice in Matlab
6 ビュー (過去 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 で Measurements and Spatial Audio についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!