static autoSound synthesize_pitch_hum (Manipulation me) { try { if (! my pitch) Melder_throw (U"Missing pitch tier."); autoPointProcess pulses = PitchTier_to_PointProcess (my pitch.get()); return PointProcess_to_Sound_hum (pulses.get()); } catch (MelderError) { Melder_throw (me, U": pitch hum manipulation not synthesized."); } }
static autoSound synthesize_pitch (Manipulation me) { try { if (! my pitch) Melder_throw (U"Missing pitch tier."); autoPointProcess pulses = PitchTier_to_PointProcess (my pitch.get()); return PointProcess_to_Sound_pulseTrain (pulses.peek(), 44100, 0.7, 0.05, 30); } catch (MelderError) { Melder_throw (me, U": pitch manipulation not synthesized."); } }
autoSound PitchTier_to_Sound_pulseTrain (PitchTier me, double samplingFrequency, double adaptFactor, double adaptTime, long interpolationDepth, bool hum) { static double formant [1 + 6] = { 0.0, 600.0, 1400.0, 2400.0, 3400.0, 4500.0, 5500.0 }; static double bandwidth [1 + 6] = { 0.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.0 }; try { autoPointProcess point = PitchTier_to_PointProcess (me); autoSound sound = PointProcess_to_Sound_pulseTrain (point.peek(), samplingFrequency, adaptFactor, adaptTime, interpolationDepth); if (hum) { Sound_filterWithFormants (sound.peek(), 0.0, 0.0, 6, formant, bandwidth); } return sound; } catch (MelderError) { Melder_throw (me, U": not converted to Sound (pulse train)."); } }
autoSound PitchTier_to_Sound_phonation (PitchTier me, double samplingFrequency, double adaptFactor, double maximumPeriod, double openPhase, double collisionPhase, double power1, double power2, bool hum) { static double formant [1 + 6] = { 0.0, 600.0, 1400.0, 2400.0, 3400.0, 4500.0, 5500.0 }; static double bandwidth [1 + 6] = { 0.0, 50.0, 100.0, 200.0, 300.0, 400.0, 500.0 }; try { autoPointProcess point = PitchTier_to_PointProcess (me); autoSound sound = PointProcess_to_Sound_phonation (point.peek(), samplingFrequency, adaptFactor, maximumPeriod, openPhase, collisionPhase, power1, power2); if (hum) { Sound_filterWithFormants (sound.peek(), 0.0, 0.0, 6, formant, bandwidth); } return sound; } catch (MelderError) { Melder_throw (me, U": not converted to Sound (phonation)."); } }
PointProcess PitchTier_Point_to_PointProcess (PitchTier me, PointProcess vuv, double maxT) { try { autoPointProcess fullPoint = PitchTier_to_PointProcess (me); autoPointProcess thee = PointProcess_create (my xmin, my xmax, fullPoint -> maxnt); /* * Copy only voiced parts to result. */ for (long i = 1; i <= fullPoint -> nt; i ++) { double t = fullPoint -> t [i]; if (PointProcess_isVoiced_t (vuv, t, maxT)) { PointProcess_addPoint (thee.peek(), t); } } return thee.transfer(); } catch (MelderError) { Melder_throw (me, " & ", vuv, ": not converted to PointProcess."); } }