Extract all peaks of pitches


Dear Praat Community,

I need advice:
I want to (automatically) extract the amounts of (word)accents in a read text audio file. The audio is in German and accent is determined as the break of pitch towards its environment. That makes an accent the peak of pitch.

How do I do that?




This is what I got....

# Praat script to extract pitch peaks from a sound file

# Set the file name and path to your audio file

file$ = "....wav"


# Set the time step in seconds

time_step = 0.01


# Set the pitch ceiling in Hz

pitch_ceiling = 1000


# Create a new Pitch object with the specified pitch ceiling

To Pitch (ac): 0, time_step, pitch_ceiling, 500, 0.03, 0.45, 0.01, 0.35, 0.14, "yes", "no", 0.1, "default"


# Extract the pitch contour and create a new PointProcess object

To Pitch...

Remove octave jumps and nonlinearities

Extract pitch tier

Down to PitchTier

To PointProcess...


# Set the minimum pitch strength and peak duration in seconds

min_pitch_strength = 0.5

min_peak_duration = 0.05


# Loop through each pitch point and check for peaks

n = Get number of points

pitch_peaks = ""

for i from 2 to n-1

  # Check if the current point is a peak

  if (Get value... i > Get value... i-1 and Get value... i > Get value... i+1 and Get value at time... i > min_pitch_strength)

    # Check if the peak duration is long enough

    peak_duration = Get time from time tier... 1 i - Get time from time tier... 1 i-1

    if (peak_duration > min_peak_duration)

      # Add the peak to the output string

      pitch_peaks += Get time from time tier... 1 i + "\n"





# Save the pitch peaks to a text file

Write to text file... "/Users/inch/Desktop/PraatVersuch", pitch_peaks

apparently there is sth wrong in line 12: Argument “Pitch ceiling” should be a number, not a string. Script line 12 not performed or completed:

« To Pitch (ac): 0, time_step, pitch_ceiling, 500, 0.03, 0.45, 0.01, 0.35, 0.14, "yes", "no", 0.1, "default" »Menu command “Run” not completed.