autoManipulation Manipulation_create (double tmin, double tmax) { try { autoManipulation me = Thing_new (Manipulation); my xmin = tmin, my xmax = tmax; my duration = DurationTier_create (tmin, tmax); return me; } catch (MelderError) { Melder_throw (U"Manipulation object not created."); } }
DurationTier PointProcess_upto_DurationTier (PointProcess me) { try { autoDurationTier thee = DurationTier_create (my xmin, my xmax); for (long i = 1; i <= my nt; i ++) { RealTier_addPoint (thee.peek(), my t [i], 1.0); } return thee.transfer(); } catch (MelderError) { Melder_throw (me, U": not converted to DurationTier."); } }
Sound Sound_lengthen_overlapAdd (Sound me, double fmin, double fmax, double factor) { try { if (my ny > 1) Melder_throw (U"Overlap-add works only on mono sounds."); autoSound sound = Data_copy (me); Vector_subtractMean (sound.peek()); autoPitch pitch = Sound_to_Pitch (sound.peek(), 0.8 / fmin, fmin, fmax); autoPointProcess pulses = Sound_Pitch_to_PointProcess_cc (sound.peek(), pitch.peek()); autoPitchTier pitchTier = Pitch_to_PitchTier (pitch.peek()); autoDurationTier duration = DurationTier_create (my xmin, my xmax); RealTier_addPoint (duration.peek(), 0.5 * (my xmin + my xmax), factor); autoSound thee = Sound_Point_Pitch_Duration_to_Sound (sound.peek(), pulses.peek(), pitchTier.peek(), duration.peek(), 1.5 / fmin); return thee.transfer(); } catch (MelderError) { Melder_throw (me, U": not lengthened."); } }