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