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.

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).

I also ran into other problems, such as the intensity not reaching the same lower peaks as it does in praat.

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

so, I decided to use pitch by cross-correlation and adjusted some other parameters, which gave me a better shape.

here is a comparison of the two of them

the blue line (cross-correlation) is much closer to the Praat version than the yellow line (standard pitch analysis).

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.