demoWindow.praat 1.6 KB

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