VocalTract.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef _VocalTract_h_
  2. #define _VocalTract_h_
  3. /* VocalTract.h
  4. *
  5. * Copyright (C) 1992-2011,2015,2017 Paul Boersma
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This code is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #include "Vector.h"
  21. #include "Graphics.h"
  22. Thing_define (VocalTract, Vector) {
  23. void v_info ()
  24. override;
  25. int v_domainQuantity ()
  26. override { return MelderQuantity_DISTANCE_FROM_GLOTTIS_METRES; }
  27. };
  28. /*
  29. Attributes:
  30. xmin // 0.
  31. xmax > xmin // Total length (metres).
  32. nx >= 1 // Number of sections.
  33. dx > 0.0 // Section length (metres).
  34. x1 // Centre of first section (metres).
  35. ymin, ymax, ny, dy, y1 = 1
  36. z [1] [1..nx] // The area, in square metres.
  37. */
  38. autoVocalTract VocalTract_create (integer nx, double dx);
  39. /*
  40. Function:
  41. create a VocalTract.
  42. Preconditions:
  43. nx >= 1;
  44. dx > 0.0;
  45. Postconditions:
  46. my xmin == 0; my ymin == 1;
  47. my xmax == nx * dx; my ymax == 1;
  48. my nx == nx; my ny == 1;
  49. my dx == dx; my dy == 1;
  50. my x1 == 0.5 * dx; my y1 == 1;
  51. my z [1] [1..nx] == 1e-4; // straight tube, area 1 cm2.
  52. */
  53. autoVocalTract VocalTract_createFromPhone (conststring32 phone);
  54. /* 'phone' is one of the following: a e i o u y1 y2 y3 jery p t k x pa ta ka pi ti ki pu tu ku */
  55. void VocalTract_draw (VocalTract me, Graphics g); /* Draw a VocalTract into a Graphics. */
  56. autoMatrix VocalTract_to_Matrix (VocalTract me);
  57. /*
  58. Create a Matrix from a VocalTract,
  59. with deep copy of all of its Matrix attributes, except class information and methods.
  60. */
  61. autoVocalTract Matrix_to_VocalTract (Matrix me);
  62. /*
  63. Function:
  64. create a VocalTract from a Matrix.
  65. Postconditions:
  66. thy xmin == my xmin;
  67. thy xmax == my xmax;
  68. thy nx == my nx;
  69. thy dx == my dx;
  70. thy x1 == my x1;
  71. thy ymin ymax ny dy y1 == 1;
  72. thy z [1] [...] == my z [1] [...];
  73. */
  74. /* End of file VocalTract.h */
  75. #endif