3
$\begingroup$

I am currently working on a guitar training progam that compares guitar input from a guitar to a song as you play, to give a score of how well you're playing. The reference song is converted from MIDI to a waveform. The user input is taken in by cable as an audio stream. I want to compare the user input to the reference. Essentially, I want to compare the two signals in terms of pitch similarity. I am not necessarily interested in detecting the note of the input signal, just how similar the pitch is to the reference sound.

I have tried comparing frequencies using FFT, but sometimes there is a difference in the peak frequency between the guitar input and the computer generated audio when the same note is being played.

Does anyone have any advice on which method I could use that would be possible to use in realtime?

$\endgroup$
1
  • 1
    $\begingroup$ I think you need a good pitch detector and you wanna compare the tracked pitch to the MIDI NoteOn messages. $\endgroup$ Mar 11, 2023 at 13:23

2 Answers 2

2
$\begingroup$

but sometimes there is a difference in the peak frequency between the guitar input and the computer generated audio

That's expected. The peak frequency often doesn't map to the actual fundamental frequency. Different guitars have different harmonic spectra. That's why a Les Paul sounds different from a Stratocaster, etc.

The reference song is converted from MIDI to a waveform.

Per RBJ's comment: this seems counter productive. The midifile already contains the main information you need: what note, start time and end time.

I am not necessarily interested in detecting the note

I don't think there is a way around that. If it's just well separated single notes, you could try cross correlation in the frequency domain using a sliding DFT or maybe a peak Cepstrum (https://en.wikipedia.org/wiki/Cepstrum)

$\endgroup$
2
$\begingroup$

Pitch and peak frequency are two different things. Peak frequency is a terrible measure of pitch for many acoustic guitar sounds or notes.

If the two guitar audio inputs (real and synthesized) are similar in instrument type and sound, then (instead of trying to estimate pitch) you could try comparing the train of overtones in the spectra of the two audio tracks, maybe using some sort of correlation measure of the spectra (with its multiple peaks of note harmonics) in the frequency domain.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.