Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Shift Frequencies

132 views
Skip to first unread message

Pr S

unread,
Dec 28, 2021, 2:27:06 AM12/28/21
to Parselmouth
Hi,
I am new to Parselmouth and am trying to use it to shift pitch frequencies.

I do the following in the Praat GUI :
1. Create a manipulation object from a sound object from the GUI
2. Click on the manipulation object and select View&Edit
3. Select the entire pitch manipulation section and click on Pitch in the menu
4. Then select Shift frequencies
5. Give a factor value of -20.0 and select unit as Hertz and click OK

I am trying to do this in code like this:

sound = parselmouth.Sound(WAV_file_path)
manipulation = call(sound, "To Manipulation", 0.01, 75, 600)
pitch_tier = call(manipulation, "Extract pitch tier")
call(pitch_tier, "Shift frequencies", -20.0, "Hertz")

I get this error: PraatError: Argument "right Time range" should be a number, not a string.
Could you tell me how to overcome this error.

I checked the Praat script. The command to Shift frequencies is:
Shift pitch frequencies: -20, "Hertz"
It takes only 2 parameters which I have specified in the call function.

Regards,
PS

yannick...@gmail.com

unread,
Dec 28, 2021, 9:36:38 AM12/28/21
to Parselmouth
Hi!

And welcome :-)

So, the thing is that Parselmouth (currently; not sure how hard it is to add) doesn't allow you to access "View & Edit" and the commands there. However, I've found that all of these commands tend to also be accessible in the main object window.
In your case, for example, when selecting a PitchTier, you have the action "Shift frequencies" in the "Modify" menu, but this one takes two extra arguments, the start and end time where you want to shift frequencies (whereas in "View & Edit", that's probably based on your selection?).

call(pitch_tier, "Shift frequencies", sound.tmin, sound.tmax, -20.0, "Hertz")

should probably do it?
I do realize this is a bit confusing, yes. Your Python script doesn't contain "View & Edit", and I assume Praat does use that editor? Alternatively, if you already have a Praat script, you might just try to run it with `parselmouth.praat.run` or `parselmouth.praat.run_file`, if that helps?

I hope this solves the issue and questions you might have? If not, do please send another message :-)


Kind regards
Yannick
Reply all
Reply to author
Forward
0 new messages