| 1 |
#! Praat script guentherGjajaDemo.praat |
| 2 |
# Paul Boersma, 6 May 2009 |
| 3 |
|
| 4 |
demo Erase all |
| 5 |
demo Black |
| 6 |
demo Line width... 1 |
| 7 |
demo Times |
| 8 |
demo 12 |
| 9 |
demo Select inner viewport... 0 100 0 100 |
| 10 |
demo Axes... 0 100 0 100 |
| 11 |
demo Text... 50 centre 50 half Please give this window the right size, then click to start. |
| 12 |
demoWaitForInput ( ) |
| 13 |
# After resizing, the viewport has to be set again. |
| 14 |
demo Select inner viewport... 0 100 0 100 |
| 15 |
demo Erase all |
| 16 |
demo Draw line... 0 0 30 70 |
| 17 |
demoWaitForInput ( ) |
| 18 |
demo Erase all |
| 19 |
demo Red |
| 20 |
demo Draw line... 0 0 7 3 |
| 21 |
demo Text... 50 centre 50 half Click in the sound to stop. |
| 22 |
duration = 3 |
| 23 |
Create Sound from formula... sine Mono 0 duration 1000 sin(2*pi*20*x) |
| 24 |
demo Select outer viewport... 0 40 0 40 |
| 25 |
demo Draw... 0 0 0 0 yes curve |
| 26 |
while 1 |
| 27 |
demoWaitForInput ( ) |
| 28 |
if demoClicked ( ) |
| 29 |
# We're gonna show that demoX and demoY can look at the whole window or into a part. |
| 30 |
demo Select inner viewport... 0 100 0 100 |
| 31 |
demo Axes... 0 100 0 100 |
| 32 |
x1 = demoX ( ) |
| 33 |
y1 = demoY ( ) |
| 34 |
clickedInTheSound = 0 |
| 35 |
if x1 > 0 and x1 < 40 and y1 > 0 and y1 < 40 |
| 36 |
demo Select outer viewport... 0 40 0 40 |
| 37 |
demo Axes... 0 duration -1 1 |
| 38 |
x2 = demoX ( ) |
| 39 |
y2 = demoY ( ) |
| 40 |
clickedInTheSound = x2 > 0 and x2 < duration and y2 > -1 and y2 < 1 |
| 41 |
endif |
| 42 |
if clickedInTheSound |
| 43 |
echo Hit the sound! |
| 44 |
printline 'x2:6' 'y2:6' |
| 45 |
goto end |
| 46 |
else |
| 47 |
echo 'x1:3' 'y1:3' |
| 48 |
endif |
| 49 |
elsif demoKeyPressed ( ) |
| 50 |
key$ = demoKey$ ( ) |
| 51 |
printline Key <<'key$'>> |
| 52 |
endif |
| 53 |
endwhile |
| 54 |
label end |
| 55 |
demo Erase all |
| 56 |
demo Select inner viewport... 0 100 0 100 |
| 57 |
demo Axes... 0 100 0 100 |
| 58 |
demo Text... 50 centre 50 half You have finished. |