0

Does anyone know of a Praat script or method for plotting the rate of change of vocal pitch? At a pinch I could do the plotting in Excel if I could extract the raw time / pitch data.

2 Answers 2

0

The easiest method is, in the editor, to get the pitch listing for the selection, which gives you time and pitch value pairs in the info window. The more automation you add, the more difficult it is to do it. Here is a script, which you may or may not be able to make use of, which writes values to a fixed file.

1
  • I discovered that the qTAtrainer script available on Yi Xu's homepage will write rate of change of pitch information to a file, but it won't give you a plot and it uses a smoothing algorithm that, for my money, is too aggressive.
    – rchivers
    Mar 8, 2021 at 9:31
0

If you're comfortable with Python, this is one of the provided examples in the documentation for the Parselmouth library.

snd = parselmouth.Sound("audio/the_north_wind_and_the_sun.wav")
pitch = snd.to_pitch()
pitch_values = pitch.selected_array['frequency']
pitch_values[pitch_values==0] = np.nan
plt.plot(pitch.xs(), pitch_values, 'o', markersize=2)
plt.show()

They make it a bit fancier by overlaying it onto a spectrogram:

spectrogram with pitch plotted

But parselmouth.Sound, to_pitch(), and selected_array['frequency'] are the important bits.

EDIT: If you want the differences between adjacent values:

snd = parselmouth.Sound("audio/the_north_wind_and_the_sun.wav")
pitch = snd.to_pitch() # Do Praat pitch analysis
pitch_values = pitch.selected_array['frequency'].astype(np.int16) # Get frequency as an array of signed integer values
pitch_values[pitch_values==0] = np.nan # Replace zeroes with NAN which will be ignored in plotting
diffs = np.diff(pitch_values) # Get difference between adjacent values
plt.plot(pitch.xs(), diffs, 'o', markersize=2) # Plot
plt.show()
4
  • Thanks. That looks like a pretty powerful tool but then Python would be quite a learning curve. For now what I want is the rate of change of pitch, not the pitch as per the example script.
    – rchivers
    Mar 8, 2021 at 9:28
  • @rchivers In that case, you'll want to subtract each adjacent pairs of values (with smoothing if you prefer); I can post Python code to do that if needed, but as you mention it does have a significant learning curve.
    – Draconis
    Mar 8, 2021 at 15:02
  • That's what I'm doing in Excel, but it would definitely be neater to do it in Python so if you do have time to post the code, that would be much appreciated. It might turn out to be a way in to Python / Parselmouth as well.
    – rchivers
    Mar 8, 2021 at 16:43
  • @rchivers Added an example
    – Draconis
    Mar 8, 2021 at 16:47

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.