| 1 | #ifndef _VocalTract_h_ |
| 2 | #define _VocalTract_h_ |
| 3 | /* VocalTract.h |
| 4 | * |
| 5 | * Copyright (C) 1992-2012,2015-2018,2022,2023 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 | |
| 21 | #include "Vector.h" |
| 22 | #include "Graphics.h" |
| 23 | |
| 24 | Thing_define (VocalTract, Vector) { |
| 25 | void v1_info () |
| 26 | override; |
| 27 | int v_domainQuantity () const |
| 28 | override { return MelderQuantity_DISTANCE_FROM_GLOTTIS_METRES; } |
| 29 | }; |
| 30 | |
| 31 | /* |
| 32 | Attributes: |
| 33 | xmin // 0. |
| 34 | xmax > xmin // Total length (metres). |
| 35 | nx >= 1 // Number of sections. |
| 36 | dx > 0.0 // Section length (metres). |
| 37 | x1 // Centre of first section (metres). |
| 38 | ymin, ymax, ny, dy, y1 = 1 |
| 39 | z [1] [1..nx] // The area, in square metres. |
| 40 | */ |
| 41 | |
| 42 | autoVocalTract VocalTract_create (integer nx, double dx); |
| 43 | /* |
| 44 | Function: |
| 45 | create a VocalTract. |
| 46 | Preconditions: |
| 47 | nx >= 1; |
| 48 | dx > 0.0; |
| 49 | Postconditions: |
| 50 | my xmin == 0; my ymin == 1; |
| 51 | my xmax == nx * dx; my ymax == 1; |
| 52 | my nx == nx; my ny == 1; |
| 53 | my dx == dx; my dy == 1; |
| 54 | my x1 == 0.5 * dx; my y1 == 1; |
| 55 | my z [1] [1..nx] == 1e-4; // straight tube, area 1 cm2. |
| 56 | */ |
| 57 | |
| 58 | autoVocalTract VocalTract_createFromPhone (conststring32 phone); |
| 59 | /* '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 */ |
| 60 | |
| 61 | void VocalTract_draw (VocalTract me, Graphics g); /* Draw a VocalTract into a Graphics. */ |
| 62 | |
| 63 | autoMatrix VocalTract_to_Matrix (VocalTract me); |
| 64 | /* |
| 65 | Create a Matrix from a VocalTract, |
| 66 | with deep copy of all of its Matrix attributes, except class information and methods. |
| 67 | */ |
| 68 | |
| 69 | autoVocalTract Matrix_to_VocalTract (Matrix me); |
| 70 | /* |
| 71 | Function: |
| 72 | create a VocalTract from a Matrix. |
| 73 | Postconditions: |
| 74 | thy xmin == my xmin; |
| 75 | thy xmax == my xmax; |
| 76 | thy nx == my nx; |
| 77 | thy dx == my dx; |
| 78 | thy x1 == my x1; |
| 79 | thy ymin ymax ny dy y1 == 1; |
| 80 | thy z [1] [...] == my z [1] [...]; |
| 81 | */ |
| 82 | |
| 83 | /* End of file VocalTract.h */ |
| 84 | #endif |