I have a praat script in which a pitch object and a point process are created for an object. Then combining these 2 with my initial object returns me the voice report. I want to extract only the values of some fields and save them in a file, but I cannot find a way. Is it possible or should I just produce the report and then write a script in another programming language to extract them?
My script looks like that and I plan to put it in a for loop to run for multiple objects.
sound = selectObject: 1
pitch = To Pitch (cc)... 0.01 50 15 no 0.03 0.45 0.01 0.35 0.14 300
plus sound
pulses = To PointProcess (cc)
plus sound
plus pitch
voiceReport$ = Voice report... 0 0 50 300 1.3 1.6 0.03 0.45
Use the extractWord$()
, extractLine$()
, and extractNumber()
string functions.
Respectively, they extract from a string (in this case, voiceReport$
) the word, line, or number that follows a specified string. You can use that specified string to identify the field in the voice report that you want.
Here's an example:
synth = Create SpeechSynthesizer: "English", "default"
sound = To Sound: "This is some text.", "no"
pitch = To Pitch (cc)... 0.01 50 15 no 0.03 0.45 0.01 0.35 0.14 300
selectObject: sound, pitch
pulses = To PointProcess (cc)
selectObject: sound, pulses, pitch
voiceReport$ = Voice report... 0 0 50 300 1.3 1.6 0.03 0.45
total_pulses = extractNumber(voiceReport$, "Number of pulses:")
writeInfoLine: "Found ", total_pulses, " pulses"
removeObject: synth, sound, pitch, pulses