Removed interference between SaveAudio and Read performance
[sgc2.git] / ToneProt / DrawToneContour.praat
blob97c2ecb4cccda47480807fd19cca481636f8cd25
1 #! praat
4 # Draw the correct tone tracks
6 # Needs
7 # include ToneScript.praat
9 procedure drawToneContour drawToneContour.pinyin$ drawToneContour.register
10         # Clean up input
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$
17         endif
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
26         # Draw Pitch track
27         select Pitch 'drawToneContour.pinyin$'
28         demo Select outer viewport... 20 80 40 100
29         demo Axes... 0 100 0 100
30         demo Line width... 1
31         demo Green
32         demo Draw... 0 0 0 'drawToneContour.freqTop' 0
33         demo Line width... 3
34         demo Green
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
39         # Clean up
40         select Pitch 'drawToneContour.pinyin$'
41         Remove
42 endproc
45 procedure drawSourceToneContour drawToneContour.sourcePitch
46         if drawToneContour.sourcePitch > 0
47                 call reset_viewport
48                 demo Select inner viewport... 20 80 40 100
49                 demo Axes... 0 100 0 100
50         
51             select drawToneContour.sourcePitch
52             demo Red
53             demo Line width... 3
54             demo Draw... 0 0 0 'freqTop' 0
55         
56             demo Line width... 1
57                 call reset_viewport
58         endif
59 endproc