Cochleagram.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef _Cochleagram_h_
  2. #define _Cochleagram_h_
  3. /* Cochleagram.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 "Matrix.h"
  21. Thing_define (Cochleagram, Matrix) {
  22. int v_domainQuantity ()
  23. override { return MelderQuantity_TIME_SECONDS; }
  24. };
  25. /* Normally, the attributes will meet the following:
  26. xmin; // Start time (seconds).
  27. xmax; // End time (seconds).
  28. nx; // Number of time slices.
  29. dx; // Time step (seconds).
  30. x1; // Centre of first time sample (seconds).
  31. ymin = 0.0; // Minimum frequency (Bark).
  32. ymax = 25.6; // Maximum frequency (Bark).
  33. ny; // Number of frequencies.
  34. dy = 25.6 / ny; // Frequency step (Bark).
  35. y1 = 0.5 * dy; // Centre of first frequency band (Bark).
  36. z; // Basilar filter output (milliVolt), or firing rate (Hz), or intensity (phon).
  37. */
  38. autoCochleagram Cochleagram_create (double tmin, double tmax, integer nt, double dt, double t1,
  39. double df, integer nf);
  40. /*
  41. Function:
  42. return a new instance of Cochleagram.
  43. Preconditions:
  44. dt > 0.0; df > 0.0;
  45. nt >= 1; nf >= 1;
  46. Postconditions:
  47. result -> xmin == tmin; result -> ymin == 0.0;
  48. result -> xmax == tmax; result -> ymax == 25.6;
  49. result -> nx == nt; result -> ny == nf;
  50. result -> dx == dt; result -> dy == df;
  51. result -> x1 == t1; result -> y1 == 0.5 * df;
  52. result -> z [1..nf] [1..nt] == 0.0;
  53. */
  54. void Cochleagram_paint (Cochleagram me, Graphics g, double tmin, double tmax, bool garnish);
  55. double Cochleagram_difference (Cochleagram me, Cochleagram thee, double tmin, double tmax);
  56. autoCochleagram Matrix_to_Cochleagram (Matrix me);
  57. /*
  58. Function:
  59. create a Cochleagram from a Matrix,
  60. with deep copy of all its attributes, except class information and methods.
  61. Fail if out of memory.
  62. */
  63. autoMatrix Cochleagram_to_Matrix (Cochleagram me);
  64. /*
  65. Function:
  66. create a Matrix from a Cochleagram,
  67. with deep copy of all its attributes, except class information and methods.
  68. Fail if out of memory.
  69. */
  70. /* End of file Cochleagram.h */
  71. #endif