-2

The premise of the project will be:

There will be a prerecorded track of guitar, for example. The student will play the same track on his guitar. I need to compare these two sounds and find out whether the student played it good or not. I will be using STM32 microcontroller and Keil uVision software for simulation at first (programming at C).

I know that I will be using an ADC using DMA and I assume I would Fast Fourier Transform the wave signals and then somehow compare the two frequency responses. Also, would there be a problem with tempo? I mean it is not logical that every note will hit on the exact ms and then compare it

I've seen some methods like Hidden Markov Model or Goertzel algorithm but I am not quite sure what they do and if they are optimal and easy for the project. So my question would be: is there a specific algorithm that suits best and how would I implement it on my code (since I haven't really started working on code, mostly theoretical reading so far).

edit: I've made a similar post yesterday but my premise was too complicated to solve so I am posting on a new premise, much easier to accomplish. I thought not to ask on the first thread since it would mix up two different issues.

Roy
  • 31
  • 5
  • If this is just a short project for school then it still sounds too ambitious - you might want to aim for something more achievable within a timescale of a few weeks to a few months. – Paul R Sep 20 '13 at 21:06

1 Answers1

0

Assuming that you can use FFT to find out which notes are playing at what time (this may prove to be difficult for distorted guitar chords), you can do this e.g. 10 times per second for both streams, and then check how often the notes in both streams match. This will give you a percentage, if you need a binary value you'd have to use a threshold value.

If both streams are not equal length (different tempo) then you will have to stretch. You don't have to stretch the actual audio, just the times between the note measurements (e.g. every 100 ms for the first stream and every 125 seconds for the second stream).

So the biggest problem may be to find out what notes are playing at any given moment in time. I'd start with constructing a mapping of frequencies to notes. Also it may be a good idea to low-pass filter the signal at around 1100 Hz to already get rid of some of the unwanted harmonics (you can't play higher than that on the guitar anyway) and similaryly high-pass filter the signal at 80 Hz. Then after the FFT or DFT (not sure if it matters which you choose), find the frequencies that are close to the real note frequencies. Then pick the loudest one and those that are above a certain threshold relative to the loudest one (e.g. drop anything that is less than half as loud as the loudest one, but some experimentation will be needed to find a good threshold value).

herman
  • 11,740
  • 5
  • 47
  • 58
  • Thanks for your response. The project is meant to be a simple application, it is about learning about sound manipulation and microcontroller programming. So, mostly I am looking for hitting the notes right. Now I have something to work on since previously I had no idea where to start. Also, you misinterpreted me, I wasn't looking for someone to write the code for me:) – Roy Sep 20 '13 at 15:03
  • (character limit) If I understand correctly, I will compare the two frequency responses every e.g. 100ms. So if the track is 10s, I will compare 100 times. My question is how would I compare? I guess I would have to find the frequency with the most gain somehow in both 100ms streams and then conclude if they are in the same frequency area, that the specific note defines? – Roy Sep 20 '13 at 15:09