F0 Contour Manipulation — User Guide
Flip, expand, contract, or flatten a detected F0 contour while preserving the source duration and channel count.
What this does
The script analyses one selected Sound, derives a mono F0 reference, and creates a new target PitchTier on a fixed 10 ms control grid. Voiced F0 values can then be mirrored, expanded or contracted around a robust median-F0 centre, or replaced by a constant target. The resulting target contour is applied with Praat Manipulation and overlap-add resynthesis.
For multichannel input, pitch is analysed once from a mono reference. Each original channel is then resynthesized separately with the same target PitchTier and written back to the corresponding output channel. The original channel count is therefore preserved, although all channels share the same target F0 contour.
Quick start
- In Praat, select exactly one Sound object containing usable voiced or periodic material.
- Run
flip or expand the F0 contours.praat. - Choose a Preset, or leave Custom and select the desired Method.
- Set the pitch-analysis range so that Min_pitch and Max_pitch bracket the source F0.
- For Expand/Contract, set Expansion_factor. For Flatten, use Flatten_target_hz = 0 to use the detected median F0, or enter a fixed target frequency.
- Enable or disable Draw_visualization and Play_result, then click OK.
Methods
| Method | Transformation | Meaning |
|---|---|---|
| Flip F0 contour | newF0 = centre² / sourceF0 | Mirrors log-frequency around the median-F0 centre. An interval above the centre becomes the same interval below it, and vice versa. |
| Expand/Contract F0 | newF0 = centre × (sourceF0 / centre)^factor | Scales interval distance from the median in logarithmic pitch space. factor > 1 expands the contour; 0 < factor < 1 contracts it; factor = 1 leaves voiced F0 unchanged. |
| Flatten F0 | newF0 = targetPitch | Replaces every detected voiced control point with one constant F0. A target of 0 in the form means the detected median F0 is used. |
Only times at which the pitch analysis returns a usable voiced F0 receive target points. The script does not invent F0 values for unvoiced regions.
Presets
| Preset | Method / override |
|---|---|
| Custom | Uses the Method and parameter values currently entered in the form. |
| Flip (Mirror pitch) | Sets Method to Flip. |
| Expand (More expressive) | Sets Method to Expand/Contract and Expansion_factor = 1.5. |
| Contract (Less expressive) | Sets Method to Expand/Contract and Expansion_factor = 0.5. |
| Flatten (Monotone) | Sets Method to Flatten and Flatten_target_hz = 0, so the detected median is used. |
| Exaggerate (Strong expansion) | Sets Method to Expand/Contract and Expansion_factor = 2.0. |
| Subtle Expansion | Sets Method to Expand/Contract and Expansion_factor = 1.2. |
| High Voice Flatten | Sets Method to Flatten and Flatten_target_hz = 200 Hz. |
| Low Voice Flatten | Sets Method to Flatten and Flatten_target_hz = 100 Hz. |
Presets override only the method-specific fields listed above. The pitch range, visualization and playback settings remain as entered by the user.
Parameters
| Parameter | Default | Description |
|---|---|---|
| Preset | Custom | Selects one of the built-in method configurations. |
| Method | Flip F0 contour | Chooses Flip, Expand/Contract, or Flatten when Preset is Custom. |
| Expansion_factor | 1.3 | Log-frequency interval scaling for Expand/Contract. Values above 1 expand; values between 0 and 1 contract. |
| Flatten_target_hz | 0 | Constant F0 for Flatten. 0 uses the detected median F0. |
| Min_pitch | 70 Hz | Lower bound for Praat pitch analysis. |
| Max_pitch | 400 Hz | Upper bound for Praat pitch analysis. It must be above Min_pitch and below Nyquist. |
| Draw_visualization | Yes | Draws source/output waveforms, F0 comparison and summary information. |
| Play_result | Yes | Plays the processed Sound after completion. |
Processing
- A mono analysis reference is created when the input has more than one channel.
- Praat pitch analysis runs at 10 ms with the user-supplied
Min_pitchandMax_pitch. - The reference centre is the median detected F0. If no usable pitch is detected, the script stops.
- A target PitchTier is sampled on a fixed 10 ms grid over the Sound's real
xmintoxmax. Only voiced analysis points are transformed. - Target F0 is constrained to 20 Hz through 0.45 × sample rate for sampling safety.
- Each original channel is converted to a Manipulation object, receives the same target PitchTier, and is resynthesized with Get resynthesis (overlap-add).
- The output is created directly at the original sample rate and with the original time domain and channel count.
Visualization
When Draw_visualization is enabled, the script draws:
- Original waveform and Modified waveform in separate panels.
- Pitch Contour: original F0 in gray, processed F0 in blue, and the detected median reference in red.
- Method information, the median reference and the analysis range.
- A compact Summary strip describing the contour-transformation workflow.
The processed F0 shown in the plot is measured again from a mono display copy of the final output; it is therefore an analysis of the resynthesized result, not merely a drawing of the target PitchTier.
Output behavior
| Property | Behavior |
|---|---|
| Object name | <source>_F0_<presetName>; for Custom, the suffix is _F0_Custom. |
| Duration / time domain | Preserved from the input Sound. |
| Sample rate | Preserved from the input Sound. |
| Channels | Original channel count preserved. All channels use the same target F0 contour derived from the mono analysis reference. |
| Peak handling | Attenuate-only safety: if the absolute output peak exceeds 0.99, the Sound is scaled down to 0.99. Quieter outputs are not amplified. |
| Intermediate objects | Removed automatically. |