1

I have a lot of wav files and I need to get the maximum and minimum pitch. How can I alter this script to get this info?

I have tried to do this with max = Get maximum but this hasn't worked.

form Process files...
  sentence Path /path/to/your/files
endform

# Optional: make sure the path has a trailing slash
path$ = if right$(path$) = "/" then path$ else path$ + "/" fi

output = Create Table with column names: "output", 0,
  ... "file mean_pitch"

files = Create Strings as file list: "files", path$ + "*wav"
total_files = Get number of strings
for i to total_files
  selectObject: files
  filename$ = Get string: i
  sound = Read from file: path$ + filename$

  # Run whatever kind of analysis you want here
  # For example, get the mean pitch for each file

  pitch = To Pitch: 0, 75, 600
  mean = Get mean: 0, 0, "Hertz"

  selectObject: output
  Append row
  row = Get number of rows
  Set string value: row, "file", filename$
  Set numeric value: row, "mean_pitch", mean

  removeObject: sound, pitch
endfor

selectObject: output
Save as comma-separated file: path$ + "output.csv"

removeObject: files, output
aliencode
  • 49
  • 4

0 Answers0