Closed caluap closed 3 years ago
Hello caluap, Thanks for reporting this issue.
I was able to replicate the issue and then fix it. I've deployed the fix in version 4.1.1
, so if you update praatio you should be good to go.
If your segments are very short (word length or shorter) you will get errors from praat even with the fix. Praat needs a certain minimum window size to get good results. If your segments are phrases or longer, you'll be ok.
If you have short intervals, running extractPI without specifying the textgrid, then loading the textgrid and filtering the pitch data will give you better results. eg
from praatio import pitch_and_intensity
from praatio import tgio
maryPitchData = pitch_and_intensity.extractPI(join(wavPath, "mary.wav"),
join(pitchPath, "mary.txt"),
praatEXE, 75, 450,
forceRegenerate=False)
tg = tgio.openTextgrid(join(tgPath, "mary.TextGrid"))
tier = tg.tierDict['phones']
filteredData = tier.getValuesInIntervals(maryPitchData)
or you can try an existing helper function that gets a bunch of predetermined pitch and intensity summary values (min, max etc) for each labeled interval
maryPitchData = pitch_and_intensity.extractPI(join(wavPath, "mary.wav"),
join(pitchPath, "mary.txt"),
praatEXE, 75, 450,
forceRegenerate=False)
maryPitchSummaryData = pitch_and_intensity.generatePIMeasures(maryPitchData,
join(tgPath, "bobby_words.TextGrid"),
"word", doPitch=True,
medianFilterWindowSize=9)
wow! above and beyond, huh?
Indeed, I was getting the error you mentioned. I had found the issue I reported, but as a quick fix I hardcoded “Hertz” in the Praat script which seemed to fix the problem only to uncover that I had some segments that were too short, as you imagined.
I tried your two ideas and both worked. Thank you!!
Hey,
your “min, max, etc” left me wondering what was in the etc, so I'll just register here what I eventually found. For pitch, the returned values are:
I'm trying to use the pitch_and_intensity.extractPI function. It gives me a
PraatExecutionFailed
error.When I paste the command that Python attempted to run, Praat complains that the
optional argument “Unit” cannot have the value “True”
. The output I'm getting is:It doesn't seem to matter what unit I pass the function, although I got the feeling that in the pitch_and_intensity.py file, line 295, the pitchUnit parameter was left out!