Handle broken wordlists and audio files
[sgc2.git] / ToneProt / HumToneContour.praat
blob8ce8d66fe7462e594edc1db96b18c1b63507a2cc
1 #! praat
4 # Hum the correct tone tracks
6 # Needs
7 # include ToneScript.praat
9 procedure humToneContour humToneContour.pinyin$ humToneContour.register
10         # Clean up input
11         if humToneContour.pinyin$ <> ""
12         humToneContour.pinyin$ = replace_regex$(humToneContour.pinyin$, "^\s*(.+)\s*$", "\1", 1)
13         humToneContour.pinyin$ = replace_regex$(humToneContour.pinyin$, "5", "0", 0)
14         endif
16         # Generate reference example
17         # Start with a range of 1 octave and a speed factor of 1
18         humToneContour.toneRange = 1.0
19         humToneContour.speedFactor = 1.0
20         call toneScript 'humToneContour.pinyin$' 'humToneContour.register' 'humToneContour.toneRange' 'humToneContour.speedFactor' CorrectPitch
22         # Hum Pitch track
23         select Pitch 'humToneContour.pinyin$'
24         Hum
26         # Clean up
27         select Pitch 'humToneContour.pinyin$'
28         Remove
29 endproc