Folded sys_praat_name.patch into adaptPraat.patch, adapted patch to Praat 5.4.13
[sgc2.git] / ToneProt / HumToneContour.praat
blob1e8bda4cd269ac0fe1ff33f47ba2a92bf86878d3
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                 call add_missing_neutral_tones 'humToneContour.pinyin$'
15                 humToneContour.pinyin$ = add_missing_neutral_tones.pinyin$
16         endif
18         # Generate reference example
19         # Start with a range of 1 octave and a speed factor of 1
20         humToneContour.toneRange = 1.0
21         humToneContour.speedFactor = 1.0
22         call toneScript 'humToneContour.pinyin$' 'humToneContour.register' 'humToneContour.toneRange' 'humToneContour.speedFactor' CorrectPitch
24         # Hum Pitch track
25         select Pitch 'humToneContour.pinyin$'
26         Hum
28         # Clean up
29         select Pitch 'humToneContour.pinyin$'
30         Remove
31 endproc