In a Praat script you usually do not want to raise a Sound window. Instead, you probably want to work with objects in the Objects window only. This page tells you how to do that for voice analysis.
The pulses you see as blue lines are a PointProcess object. You can see this if you choose Extract visible pulses from the Pulses menu in the Sound window: a PointProcess object will appear in the list.
You can also create a PointProcess in the Objects window directly. To do this, select a Sound and choose Sound: To PointProcess (periodic, cc)... from the Periodicity menu.
You can also do this in two steps. First you create a Pitch with Sound: To Pitch... or Sound: To Pitch (ac)... or Sound: To Pitch (cc).... Then you select the resulting Pitch together with the original Sound and choose Sound & Pitch: To PointProcess (cc).
Since the direct method of Sound: To PointProcess (periodic, cc)... actually uses the AC method for computing the Pitch (which is optimal for intonation analysis), you may prefer the two-step version if your goal is to do voice analysis. In that case, you use Sound: To Pitch (cc)... as the first step, and Sound & Pitch: To PointProcess (cc) as the second step. This is also how the Sound window does it: if you choose Optimize for voice analysis in the Pitch settings, Praat uses Sound: To Pitch (cc)... for pitch analysis.
What you should not do if you want to perform voice analysis is to create the PointProcess by selecting a Pitch only and then choosing Pitch: To PointProcess. In that way, the resulting pulses would not be aligned to the periods in the Sound.
Once you have a PointProcess that represents the periods in the Sound, you can select it and choose some Get jitter commands from the Query submenu.
Once you have a PointProcess that represents the periods in the Sound, you can select it together with the Sound, then choose some Get shimmer commands from the Query submenu.
If you select the Sound, the Pitch, and the PointProcess together (all three), there will be a button that says Voice report.... If you press it, the voice report will be written to the Info window. This is identical to the voice report in the Sound window, although you will have to specify the time range by manually typing it.
In a script, you can get the jitter and shimmer from the voice report by doing something like:
voiceReport$ = Voice report: 0, 0, 75, 500, 1.3, 1.6, 0.03, 0.45
jitter = extractNumber (voiceReport$, "Jitter (local): ")
shimmer = extractNumber (voiceReport$, "Shimmer (local): ")
writeInfoLine: "Jitter = ", percent$ (jitter, 3), ", shimmer = ", percent$ (shimmer, 3)
In all the commands mentioned above, you have to guess the time range, and you would usually supply "0.0" and "0.0", in which case you will get the average jitter and shimmer for the whole sound. This may include parts of the sound that you are often not interested in, such as false starts. You do not have these problems when asking for a voice report in the sound window, because there you would make an explicit time selection by hand after judging what part of the sound is relevant.
© ppgb, December 2, 2022