2
$\begingroup$

I'm using python 2.7 to compare tonal differences in guitar stings.

I've found that in matplotlib, there are some great built-in features such as matplotlib.mlab.magnitude_spectrum and matplotlib.mlab.psd

The magnitude_spectrum function seems to be the no brainer, as it is the FFT of the signal, showing each specific harmonic. However, when comparing various guitar strings, it's tricky to pinpoint each peak to compare. The PSD function gives very nice smooth graphs, which is perfect for obvious visual comparisons.

My understanding is that PSD's are useful for random signals but not necessarily known signals. Is this true? And is there any reason I shouldn't be using the PSD for guitar string comparisons?

Here's what the PSD and magnitude_spectrum graphs look like:

Note that these are plucks of the same string and not different strings. I'm trying to make sure that my plucks are consistent prior to comparing various strings.

PSD Magnitude Spectrum

$\endgroup$
1
$\begingroup$

I'd really recommend going for a short-time fourier transform such as that produced by: matplotlib.mlab.specgram. It gives you the change in the spectrum over time and can be calculated using PSD or the magnitude spectrum.

The reason I'd recommend this is that your guitar signal is not spectrally stationary; your graphs are only a snapshot at one point in time. What gives your guitar string their tonal differences is the way all the harmonics shown above change over the length of the note.

There's a very good summary of PSD vs FFT magnitude here and here.

$\endgroup$
0
$\begingroup$

Based on the description provided in the description of PSD @tobassist provided the link for, the PSD is not an appropriate method to compare plucks of guitar strings. This is because the PSD "is only valid for a wide-sense stationary process because its autocorrelation function is only a function of the time lag τ and not the absolute time t..."

Ultimately it seems that the PSD should only be used on signals where the magnitude doesn't change over time. While i was using the PSD for only a short snippet of time (500ms or 1 second), it is likely that it is still not appropriate, especially when compared to the FFT / STFT.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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