PitchTier.praat 773 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # PitchTier.praat
  2. # Paul Boersma 2015-12-21
  3. writeInfoLine: "PitchTier test"
  4. tier = Create PitchTier: "tier", -1.0, 1.8
  5. Add point: 0.5, 150.0
  6. Add point: 0.6, 178.0
  7. Add point: 0.6, 180.0 ; shouldn't do anything
  8. Add point: 0.3, 200.0 ; should be inserted as the first point
  9. #
  10. # Check time domain.
  11. #
  12. tmin = Get starting time
  13. assert tmin = -1.0
  14. tmax = Get end time
  15. assert tmax = 1.8
  16. duration = Get duration
  17. assert duration = 2.8
  18. n = Get number of points
  19. assert n = 3
  20. #
  21. # Check values and sorting.
  22. #
  23. for i to n
  24. time [i] = Get time from index: i
  25. pitch [i] = Get value at index: i
  26. endfor
  27. assert time [1] = 0.3
  28. assert time [2] = 0.5
  29. assert time [3] = 0.6
  30. assert pitch [1] = 200.0
  31. assert pitch [2] = 150.0
  32. assert pitch [3] = 178.0
  33. removeObject: tier
  34. appendInfoLine: "OK"