another minor fix
[sgc.git] / SGC_ToneProt / DrawToneContour.praat
blobd6d38004fd5539738600b458e38c2309cd2de18a
1 #! praat
4 # Draw the correct tone tracks
6 form Mandarin Tone contours
7     word pinyin duo1shao3
8     real register 300
9 endform
11 # Clean up input
12 if pinyin$ <> ""
13     pinyin$ = replace_regex$(pinyin$, "^\s*(.+)\s*$", "\1", 1)
14     pinyin$ = replace_regex$(pinyin$, "5", "0", 0)
15 endif
17 # Generate reference example
18 # Start with a range of 1 octave and a speed factor of 1
19 toneRange = 1.0
20 speedFactor = 1.0
21 execute ToneScript.praat 'pinyin$' 'register' 1 1 CorrectPitch
23 freqTop = 1.5 * register
24 Erase all
25 Select outer viewport... 0 6 0 4
27 # Draw Pitch track
28 select Pitch 'pinyin$'
29 Line width... 1
30 Green
31 Draw... 0 0 0 'freqTop' 1
32 Line width... 3
33 Green
34 Draw... 0 0 0 'freqTop' 0
37 Text top... no 'pinyin$'
39 Write to short text file... ../PitchTiers/'pinyin$'-'register'.Pitch
41 To Sound (hum)
42 Write to WAV file... ../PitchTiers/'pinyin$'-'register'.wav
43 Remove
45 select Pitch 'pinyin$'
46 Down to PitchTier
47 Write to short text file... ../PitchTiers/'pinyin$'-'register'.PitchTier
48 Remove
50 # Clean up
51 select Pitch 'pinyin$'
52 Remove