Made recording time fit the utterance
[sgc2.git] / ToneProt / HumToneContour.praat
blob7c86a9cc0b42711578cf6f6e3ba3ab2c5d81c7cd
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                 if index_regex(humToneContour.pinyin$, "[0-9]") <=0
15                         humToneContour.pinyin$ = humToneContour.pinyin$+"0"
16                 endif
17         endif
19         # Generate reference example
20         # Start with a range of 1 octave and a speed factor of 1
21         humToneContour.toneRange = 1.0
22         humToneContour.speedFactor = 1.0
23         call toneScript 'humToneContour.pinyin$' 'humToneContour.register' 'humToneContour.toneRange' 'humToneContour.speedFactor' CorrectPitch
25         # Hum Pitch track
26         select Pitch 'humToneContour.pinyin$'
27         Hum
29         # Clean up
30         select Pitch 'humToneContour.pinyin$'
31         Remove
32 endproc