| 1 |
#ifndef _FormantGrid_h_ |
| 2 |
#define _FormantGrid_h_ |
| 3 |
/* FormantGrid.h |
| 4 |
* |
| 5 |
* Copyright (C) 2008-2012,2014-2018,2025 Paul Boersma & David Weenink |
| 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 "RealTier.h" |
| 22 |
#include "Sound.h" |
| 23 |
#include "Formant.h" |
| 24 |
|
| 25 |
Thing_declare (Interpreter); |
| 26 |
|
| 27 |
#include "FormantGrid_def.h" |
| 28 |
|
| 29 |
void FormantGrid_init (FormantGrid me, double tmin, double tmax, integer numberOfFormants); |
| 30 |
autoFormantGrid FormantGrid_createEmpty (double tmin, double tmax, integer numberOfFormants); |
| 31 |
|
| 32 |
autoFormantGrid FormantGrid_create (double tmin, double tmax, integer numberOfFormants, |
| 33 |
double initialFirstFormant, double initialFormantSpacing, |
| 34 |
double initialFirstBandwidth, double initialBandwidthSpacing); |
| 35 |
|
| 36 |
double FormantGrid_getFormantAtTime (constFormantGrid me, integer formantNumber, double time); |
| 37 |
double FormantGrid_getBandwidthAtTime (constFormantGrid me, integer formantNumber, double time); |
| 38 |
|
| 39 |
void FormantGrid_addFormantPoint (mutableFormantGrid me, integer formantNumber, double time, double value); |
| 40 |
void FormantGrid_addBandwidthPoint (mutableFormantGrid me, integer formantNumber, double time, double value); |
| 41 |
void FormantGrid_removeFormantPointsBetween (mutableFormantGrid me, integer formantNumber, double tmin, double tmax); |
| 42 |
void FormantGrid_removeBandwidthPointsBetween (mutableFormantGrid me, integer formantNumber, double tmin, double tmax); |
| 43 |
|
| 44 |
void Sound_FormantGrid_filter_inplace (mutableSound me, constFormantGrid formantGrid); |
| 45 |
autoSound Sound_FormantGrid_filter (constSound me, constFormantGrid formantGrid); |
| 46 |
autoSound Sound_FormantGrid_filter_noscale (constSound me, constFormantGrid formantGrid); |
| 47 |
|
| 48 |
autoSound FormantGrid_to_Sound ( |
| 49 |
constFormantGrid me, |
| 50 |
double samplingFrequency, // the sample rate of the resulting Sound |
| 51 |
double tStart, double f0Start, // time and F0 of the first pitch point |
| 52 |
double tMid, double f0Mid, // time and F0 of the second pitch point |
| 53 |
double tEnd, double f0End, // time and F0 of the third pitch point |
| 54 |
double adaptFactor, double maximumPeriod, // pulse generation settings |
| 55 |
double openPhase, double collisionPhase, double power1, double power2 // phonation shape settings |
| 56 |
); |
| 57 |
void FormantGrid_playPart ( |
| 58 |
constFormantGrid me, |
| 59 |
double tmin, double tmax, // the time range of the part to play |
| 60 |
double samplingFrequency, // the sample rate of the resulting Sound |
| 61 |
double tStart, double f0Start, // time and F0 of the first pitch point |
| 62 |
double tMid, double f0Mid, // time and F0 of the second pitch point |
| 63 |
double tEnd, double f0End, // time and F0 of the third pitch point |
| 64 |
double adaptFactor, double maximumPeriod, // pulse generation settings |
| 65 |
double openPhase, double collisionPhase, double power1, double power2, // phonation shape settings |
| 66 |
Sound_PlayCallback playCallback, mutableThing playBoss // callback to boss: cancel playing, show running cursor... |
| 67 |
); |
| 68 |
|
| 69 |
void FormantGrid_formula_frequencies ( |
| 70 |
mutableFormantGrid me, // the source (and often also the target, namely if `thee` is null) |
| 71 |
conststring32 expression, |
| 72 |
Interpreter interpreter, |
| 73 |
mutableFormantGrid thee // the target (if not null) |
| 74 |
); |
| 75 |
void FormantGrid_formula_bandwidths ( |
| 76 |
mutableFormantGrid me, // the source (and often also the target, namely if `thee` is null) |
| 77 |
conststring32 expression, |
| 78 |
Interpreter interpreter, |
| 79 |
mutableFormantGrid thee // the target (if not null) |
| 80 |
); |
| 81 |
|
| 82 |
autoFormantGrid Formant_downto_FormantGrid (constFormant me); |
| 83 |
autoFormant FormantGrid_to_Formant (constFormantGrid me, double dt, double intensity); |
| 84 |
|
| 85 |
autoSound Sound_Formant_filter (constSound me, constFormant formant); |
| 86 |
autoSound Sound_Formant_filter_noscale (constSound me, constFormant formant); |
| 87 |
|
| 88 |
/* End of file FormantGrid.h */ |
| 89 |
#endif |