Human Voice Spectrum using Matlab

In summary, to compare the spectrum of male and female voices using Matlab, you should use the spectrum objects instead of the obsolete 'spectrum' function. You also need to get the frequency as a second output when using the spectrum function and use that frequency in your plot to get the desired spectrum.
  • #1
frenzal_dude
77
0
Hi, I'm trying to compare the spectrum of male and female voices using Matlab.
I'm using this code but I get this error:
---------------------------------
Warning: SPECTRUM is obsolete and will be removed in future versions.
Use the spectrum objects instead, type "help SPECTRUM".
> In spectrum at 106
In fft at 6
? Error using ==> plot
Vectors must be the same lengths.

Error in ==> fft at 14
plot(Freq,10*log10(Y/max(Y)));
------------------------------
I heard that even though 'spectrum' is obsolete it should still work ok.
But I'm not sure how to plot the frequency domain using plot(Freq,10*log10(Y/max(Y))); even though they are different lengths, (which I assume they should be since my lecturer gave me this code).

Here's the .m file:

1. % Record sound and do spectrum analysis
2. Fs=8000; %sample rate used is 8kHz
3. N=Fs * 10; %the total number of samples in 10 secs of data
4. FFTsize=1024;
5. y=wavrecord(N,Fs); %collect your data
6. Y=spectrum(y,FFTsize); %compute the spectrum of your data
7. Freq=[10:Fs/FFTsize:Fs/2]; %frequency scale
8. Time=[1:N]/Fs;
9. subplot(2,1,1);
10. plot(Time,y);
11. ylabel('Amplitude'); %label the y axis
12. xlabel('Time(s)') %label the x axis
13. subplot(2,1,2);
14. plot(Freq,10*log10(Y/max(Y)));
15. ylabel('Spectrum(db)');
16. xlabel('Frequency(Hz)'); %label your x axisHope you guys can help.
frenzal
 
Physics news on Phys.org
  • #2
In line 6, you have to get frequency as second output like this,
[Y, freq]=spectrum(y,FFTsize)
Now in line 14, if you plot this freq instead of Freq you will get the desired spectrum.
 

1. What is a human voice spectrum?

The human voice spectrum refers to the range of frequencies that are produced by the vibration of the vocal cords and resonant cavities in the human body. It is also known as the vocal range and is measured in Hertz (Hz).

2. How can Matlab be used to analyze the human voice spectrum?

Matlab is a programming language and software platform that is commonly used in scientific and engineering fields. It can be used to analyze the human voice spectrum by processing audio signals and extracting frequency information using signal processing techniques.

3. What information can be obtained from analyzing the human voice spectrum?

By analyzing the human voice spectrum, information about the pitch, timbre, and intensity of a person's voice can be obtained. It can also reveal any abnormalities or changes in the vocal cords, which can aid in medical diagnosis and treatment.

4. Can Matlab be used to improve the human voice spectrum?

While Matlab can be used to analyze the human voice spectrum, it is not a tool for directly improving it. However, it can be used to develop algorithms and methods for voice enhancement and noise reduction, which can improve the overall quality of the human voice spectrum.

5. Is knowledge of Matlab necessary for studying the human voice spectrum?

No, knowledge of Matlab is not necessary for studying the human voice spectrum. However, it can be a useful tool for researchers and scientists in the field of speech and voice analysis, as it allows for more advanced and accurate processing of audio signals.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
8K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
5K
Back
Top