4 # Draw the correct tone tracks
7 # include ToneScript.praat
9 procedure drawToneContour drawToneContour.pinyin$ drawToneContour.register
11 if drawToneContour.pinyin$ <> ""
12 drawToneContour.pinyin$ = replace_regex$(drawToneContour.pinyin$, "^\s*(.+)\s*$", "\1", 1)
13 drawToneContour.pinyin$ = replace_regex$(drawToneContour.pinyin$, "5", "0", 0)
15 call add_missing_neutral_tones 'drawToneContour.pinyin$'
16 drawToneContour.pinyin$ = add_missing_neutral_tones.pinyin$
19 # Generate reference example
20 # Start with a range of 1 octave and a speed factor of 1
21 drawToneContour.toneRange = 1.0
22 drawToneContour.speedFactor = 1.0
23 call toneScript 'drawToneContour.pinyin$' 'drawToneContour.register' 1 1 CorrectPitch
24 drawToneContour.freqTop = 1.5 * drawToneContour.register
27 select Pitch 'drawToneContour.pinyin$'
28 demo Select outer viewport... 20 80 40 100
29 demo Axes... 0 100 0 100
32 demo Draw... 0 0 0 'drawToneContour.freqTop' 0
35 demo Draw... 0 0 0 'drawToneContour.freqTop' 0
36 demo Select outer viewport... 0 100 0 100
37 demo Axes... 0 100 0 100
40 select Pitch 'drawToneContour.pinyin$'
45 procedure drawSourceToneContour drawToneContour.sourcePitch
46 if drawToneContour.sourcePitch > 0
48 demo Select inner viewport... 20 80 40 100
49 demo Axes... 0 100 0 100
51 select drawToneContour.sourcePitch
54 demo Draw... 0 0 0 'freqTop' 0