Need help with word identification using fft()

2 views (last 30 days)
Wynand
Wynand on 23 Oct 2023
Answered: Shivansh on 15 Nov 2023
I am writing a program to listen to a voice and then return the most probable matching word. The issue I am running into is the fft() returns such similar frequency bands that comparisons are wildly similar and as such, inaccurate. I have attached a function I wrote for this goal. Any hints to get me more accurate analysis would be greatly appreciated
My database is 10 words with 10 versions each in a 10x10 cell matrix. From comparison I get get total difference between all the database words and the recorded word and the lowest value difference is assumed to be the closest match
FFT_Output was the first iteration
I tried to rewrite it more cleanly with FFT_Output_2 but I think it's mostly, functionally the same but easier to digest.
Thank you
  2 Comments
Star Strider
Star Strider on 24 Oct 2023
You would need to use either spectrogram or pspectrum (with the 'spectrogram' option), and then use relatively sophisticated pattern-matching. See Formant Estimation with LPC Coefficients for a representative approach. Using fft alone is not going to be sufficient.
Wynand
Wynand on 24 Oct 2023
Thank you for the reply. Unfortunately our objective was to use fft and not other built in functions of matlab

Sign in to comment.

Answers (1)

Shivansh
Shivansh on 15 Nov 2023
Hi Wynand,
I understand that you are using FFT to transform the voice signal into the frequency domain and then finding the peaks to differentiate between words. The issue with this approach is that it focuses mainly on the frequency content of the signal, which may not be sufficient to differentiate between different words pronounced by different people with different voice characteristics.
You can try “mfcc()” or some machine learning techniques as they can provide significantly better results.
Since you want to experiment with fft(), you can still improve your results by refining your FFT-based approach. You can work on following suggestions:
  1. You can try using a larger number of bins and base them on any other scale instead dividing the FFT output into bins of equal width.
  2. You are currently using the “findpeaks” function with fixed parameters which might not be optimal for every word. You can consider using a more sophisticated peak detection algorithm for audio signals.
  3. You are currently only using the magnitude of the FFT output. You can try including phase outputs for distinguishing between different words.
  4. You can also experiment with different windows other than Blackman window.
  5. You might want to use overlapping frames instead of dividing your signal into non-overlapping frames. This can provide a smoother representation of the signal and might improve your results.
You can refer to the following link for more information regarding “fft()” https://in.mathworks.com/help/matlab/ref/fft.html.
Hope it helps!

Categories

Find more on Measurements and Spatial Audio in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!