it can open .wav file ,and then create TextGrid file after that cut file by TextGrid file intervals[]?

64 views
Skip to first unread message

Vegetable Chicken

unread,
Mar 1, 2021, 3:16:26 AM3/1/21
to Parselmouth
by praat visual tool ,we can open file and click Annotate-TextGrid(sentence) button  to create TextGrid file ,then we can read TextGrid file's and use the interval of item[],to cut .wav file.
so ,up what i descriped,can finished by Parsemouth code???

yannick...@gmail.com

unread,
Mar 2, 2021, 5:33:26 AM3/2/21
to Parselmouth
Hello

You should be able to do something similar with Parselmouth, yes. The `TextGrid` API isn't very developed, yet, but you can use `text_grid.to_tgt()` to get a TextGridTools object (see https://textgridtools.readthedocs.io/en/stable/). Using that, you could e.g. use `Sound.extract_part(from_time=..., to_time=...)` to extract the different fragments.
Does this help?

Op maandag 1 maart 2021 om 09:16:26 UTC+1 schreef vegetables...@gmail.com:

Meghna Reddy

unread,
Feb 4, 2022, 2:32:17 PM2/4/22
to Parselmouth
Hi, I'm trying to perform the same operation. Would really appreciate if you could share how you went about this on your python file! :)

yannick...@gmail.com

unread,
Feb 14, 2022, 11:02:42 AM2/14/22
to Parselmouth
Hi Meghna

I don't have the exact same code around and I don't know exactly what you're trying to do, but you can loop over the tiers in a TextGrid object from TextGridTools (https://textgridtools.readthedocs.io/en/stable/), loop over the intervals in the tier you're interested in, and then call `Sound.extract_part(from_time=..., to_time=...)` and `Sound.save("file.wav", 'WAV')`.
Without more context, there's not much more that I can say. I'd advise you have a read of TextGridTools, and just start playing around with it in a script.
Reply all
Reply to author
Forward
0 new messages