Sound Sound_FormantGrid_filter (Sound me, FormantGrid formantGrid) { Sound thee = (structSound *)Data_copy (me); if (! thee) return NULL; Sound_FormantGrid_filter_inline (thee, formantGrid); Vector_scale (thee, 0.99); return thee; }
Sound Sound_FormantGrid_filter_noscale (Sound me, FormantGrid formantGrid) { try { autoSound thee = Data_copy (me); Sound_FormantGrid_filter_inline (thee.peek(), formantGrid); return thee.transfer(); } catch (MelderError) { Melder_throw (me, ": not filtered with ", formantGrid, "."); } }
Sound FormantGrid_to_Sound (FormantGrid me, double samplingFrequency, double tStart, double f0Start, double tMid, double f0Mid, double tEnd, double f0End, double adaptFactor, double maximumPeriod, double openPhase, double collisionPhase, double power1, double power2) { try { autoPitchTier pitch = PitchTier_create (my xmin, my xmax); RealTier_addPoint (pitch.peek(), my xmin + tStart * (my xmax - my xmin), f0Start); RealTier_addPoint (pitch.peek(), my xmin + tMid * (my xmax - my xmin), f0Mid); RealTier_addPoint (pitch.peek(), my xmax - (1.0 - tEnd) * (my xmax - my xmin), f0End); autoSound thee = PitchTier_to_Sound_phonation (pitch.peek(), samplingFrequency, adaptFactor, maximumPeriod, openPhase, collisionPhase, power1, power2, false); Sound_FormantGrid_filter_inline (thee.peek(), me); return thee.transfer(); } catch (MelderError) { Melder_throw (me, ": not converted to Sound."); } }
Sound FormantGrid_to_Sound (FormantGrid me, double samplingFrequency, double tStart, double f0Start, double tMid, double f0Mid, double tEnd, double f0End, double adaptFactor, double maximumPeriod, double openPhase, double collisionPhase, double power1, double power2) { PitchTier pitch = NULL; Sound thee = NULL; pitch = PitchTier_create (my xmin, my xmax); cherror RealTier_addPoint (pitch, my xmin + tStart * (my xmax - my xmin), f0Start); cherror RealTier_addPoint (pitch, my xmin + tMid * (my xmax - my xmin), f0Mid); cherror RealTier_addPoint (pitch, my xmax - (1.0 - tEnd) * (my xmax - my xmin), f0End); cherror thee = PitchTier_to_Sound_phonation (pitch, samplingFrequency, adaptFactor, maximumPeriod, openPhase, collisionPhase, power1, power2, false); cherror Sound_FormantGrid_filter_inline (thee, me); end: forget (pitch); iferror forget (thee); return thee; }