| 1 |
/* Cochleagram_and_Excitation.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 1992-2011,2015,2017 Paul Boersma |
| 4 |
* |
| 5 |
* This code is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
* See the GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
/* |
| 20 |
* pb 1993/12/20 |
| 21 |
* pb 2002/07/16 GPL |
| 22 |
* pb 2011/05/05 type |
| 23 |
* pb 2011/05/09 C++ |
| 24 |
*/ |
| 25 |
|
| 26 |
#include "Cochleagram_and_Excitation.h" |
| 27 |
|
| 28 |
autoExcitation Cochleagram_to_Excitation (Cochleagram me, double t) { |
| 29 |
try { |
| 30 |
integer column = Matrix_xToNearestColumn (me, t); |
| 31 |
if (column < 1) column = 1; |
| 32 |
if (column > my nx) column = my nx; |
| 33 |
autoExcitation thee = Excitation_create (my dy, my ny); |
| 34 |
for (integer ifreq = 1; ifreq <= my ny; ifreq ++) |
| 35 |
thy z [1] [ifreq] = my z [ifreq] [column]; |
| 36 |
return thee; |
| 37 |
} catch (MelderError) { |
| 38 |
Melder_throw (me, U": slice at time ", t, U" seconds not extracted to Excitation."); |
| 39 |
} |
| 40 |
} |
| 41 |
|
| 42 |
/* End of file Cochleagram_and_Excitation.cpp */ |