0

I need help with my experimentation on MATLAB. I am trying to get the frequency range of a song per time interval. For example, if a person sings, what is his frequency range from time 0 to 0.5seconds? I have tried using the spectrogram function of MATLAB but I can't figure out how to extract my needed values from the returned values.

I hope you could help me (newbie).

Thank you very much. I appreciate your help.

  • 2
    Why don't you show the output you are getting and the code you used to get it - it would be easier to help you. – Floris Mar 31 '15 at 14:52
  • Hi, thank you for your reply. I have outputted a spectrogram that looks like this docs.google.com/file/d/0B0gNKHg8ApCsSFZMdkRSRk9DdWs/edit How do I perform the slicing from the returned matrix values from this method [s,w,t] = spectrogram(f(:,2),256,[],1024,fs,'yaxis'); ? 'fs' is the sampling rate from the audioread() method and 'f' is the data signals. I can't seem to understand the fourth parameter 1024 (frequency) and what it does in the spectrogram. Thank you very much for your help! – user3286528 Apr 01 '15 at 01:13

1 Answers1

1

First you need to understand what a spectrogram is doing; it is splitting your signal into shorter (but fixed) time lengths and doing a FFT on it (hence, it is also known as a STFT representation). Matlab spectrogram has many options which you can play around with.

Now to your question, to work out the frequency range of your signal by looking at the spectrogram data, you will need to work out the time length of your Spectrogram bin first by using NFFT, Number of Overlaps and Sampling frequency (I assume you worked this out before you constructed the spectrogram). In dealing with good quality speech (sampled at 16kHz, overlapping 50% and 1024 NFFT) should return around 32ms per bin (or slice of the spectrogram). To work out what frequency were present for 0 to 500ms, simply take the first ceil(500/32) bins and write out the frequency response; you are likely to get multiple frequencies since speech has both harmonic properties as well as spreading properties.

As for the rest, I will need to know exactly what your settings/what you are hoping to achieve before offering any useful help.

GameOfThrows
  • 4,510
  • 2
  • 27
  • 44
  • Hi, thank you for your reply. I have outputted a spectrogram that looks like this https://docs.google.com/file/d/0B0gNKHg8ApCsSFZMdkRSRk9DdWs/edit How do I perform the slicing from the returned matrix values from this method [s,w,t] = spectrogram(f(:,2),256,[],1024,fs,'yaxis'); ? 'fs' is the sampling rate from the audioread() method and 'f' is the data signals. I can't seem to understand the fourth parameter 1024 (frequency) and what it does in the spectrogram. Thank you very much for your help! – user3286528 Apr 01 '15 at 01:09