intensity and pitch diferences in parselmouth compared to praat

21 views
Skip to first unread message

Ekartle YaBoi

unread,
Jun 30, 2025, 3:17:17 PMJun 30
to Yannick Jadoul, parse...@googlegroups.com
Hi Yannick

i’m working on a project where I need to plot both intensity and pitch graphs. The goal is for these graphs to look as similar to the ones in Praat as possible. However, when I try plotting the intensity, for some reason it’s off by about 700 Hz, and I just can’t find any way to fix it within Praat.  
python_Aurv0eslEN.png
So instead, I just modified the np array manually to shift it downwards a bit, which of course isn’t the ideal solution (the white line is the modified one).  
python_8uNyodsiZw.png
I also ran into other problems, such as the intensity not reaching the same lower peaks as it does in praat.
NfC5g0JuX7.png
here is the code im using
def draw_intensity_old():

    ax = plt.twinx()
    ax.yaxis.set_ticks([])
    plt.grid(False)

    intensity = sound.to_intensity()

    plt.plot(intensity.xs(), intensity.values.T, linewidth=3, color="#28c361")

    plt.ylim(0)
def draw_intensity():

    ax = plt.twinx()
    ax.yaxis.set_ticks([])
    plt.grid(False)

    intensity = sound.to_intensity()

    #im manually resting about 120hz in the scale, only that here you have to multply them by 10
    plt.plot(intensity.xs(), intensity.values.T - 12 , linewidth=3, color="#d6d0cf")

    #i also have to add a second original plot for references so that matplot moves the modified line
    plt.plot(intensity.xs(), intensity.values.T, linewidth=3, alpha=0)

    plt.ylim(0)

Additionally, I had a similar problem with pitch, although I managed to solve it within parselmouth.

The pitch was also a bit too high and didn’t match praat, so I did the same thing: I moved it by directly modifying the array. But that still left a slightly inaccurate shape, especially at the endings of the lines

python_F3PJm3jbXX.png
 so, I decided to use pitch by cross-correlation and adjusted some other parameters, which gave me a better shape.  
python_8QRdSCMMNR.png
here is a comparison of the two of them
python_uCeC8RJHZT.png
 the blue line (cross-correlation) is much closer to the Praat version than the yellow line (standard pitch analysis).  

nmqLzQmRbZ.png
def draw_pitch_old():

    ax = plt.twinx()
    ax.yaxis.set_ticks([])
    plt.grid(False)

    pitch = sound.to_pitch()
    pitch_values = pitch.selected_array['frequency']
   
    pitch_posmo = pitch_values + 105
    pitch_posmo[pitch_values==0] = np.nan

    plt.plot(pitch.xs(), pitch_posmo , linewidth=3, color="#d3c425")

    plt.ylim(0, pitch.ceiling)
    plt.xlim([sound.xmin, sound.xmax])
def draw_pitch():

    ax = plt.twinx()
    ax.yaxis.set_ticks([])
    plt.grid(False)

    pitch = sound.to_pitch_cc(voicing_threshold= float(0.70))

    pitch_values = pitch.selected_array["frequency"]
   
    pitch_posmo = pitch_values + 105
    pitch_posmo[pitch_values==0] = np.nan

    plt.plot(pitch.xs(), pitch_posmo , linewidth=3, color="#256fd3")

    plt.ylim(0, pitch.ceiling)
    plt.xlim([sound.xmin, sound.xmax])

So my main question is: Is there any other way to analyze intensity/pitch using Parselmouth that would fix these inaccuracies for peaks and endings? Or is there a way to shift or adjust the plot lines more accurately within Parselmouth itself?

Also, here’s the audio I’m currently working with.


cantonese test.mp3

Ekartle YaBoi

unread,
Jun 30, 2025, 3:34:24 PMJun 30
to Yannick Jadoul, parse...@googlegroups.com
sorry i meant a way mostly to analyse intensity more accurately, and to move pitch/intensity in a better way, the pitch accuracy is already good enough for me

yannick...@gmail.com

unread,
Jun 30, 2025, 6:57:29 PMJun 30
to Parselmouth
Hi!

Do have a closer look at your y-axes. In your screenshots, the right-side y-axis is missing (because you remove all ticks in the code: ax.yaxis.set_ticks([]); why!?), but clearly this is just on a different scale.
If you correctly align the ranges of the y-axis, both Parselmouth and Praat perfectly match and give the same curve:

Screenshot from 2025-07-01 00-48-04.png


Moverover, Intensity isn't measured in Hz, so they can't be "off by 700 Hz". Have a closer look inside Praat and the manual to further explore what all these measures mean: https://www.fon.hum.uva.nl/praat/manual/Sound__To_Intensity___.html

Apart from that, any other differences should be due to differences in parameters settings (for example, the Parselmouth curve seems a bit less smoothed than the Praat curve in my screenshot above). Do check that you pass the corresponding arguments to Parselmouth's `Sound.to_intensity()` method, because e.g. the "minimum pitch"/"pitch floor" argument in Praat's "View & Edit" is taken from the Pitch settings.
If you've double-checked all of this and the values don't match, do let me know, cause Parselmouth's output should perfectly match Praat!

I have a strong suspicion that the differences in pitch analysis you're seeing are most likely also due to different parameter settings (or maybe to the comparison to Praat's new "filtered" pitch detection algorithms, which have not been included yet in the latest released version of Parselmouth).


Kind regards
Yannick
Reply all
Reply to author
Forward
0 new messages