Formant to MIDI Chord Converter — User Guide
Segments a sound file, extracts the first four formants (F1-F4) from each segment, and converts them to MIDI notes (cents) to represent a time-varying chord structure.
What this does
This script is a tool for analyzing the spectral characteristics of a sound, typically speech or singing, and mapping them onto musical pitches. It divides the selected Sound object into segments, calculates the center frequency of the first four formants (F1, F2, F3, F4) in each segment, and translates these frequencies into MIDI cents (a representation of musical pitch, where 100 cents = 1 semitone).
The result is a detailed output in the Praat Info window showing the four frequencies and their corresponding closest musical notes (e.g., C4 +15¢), allowing users to see the spectral resonance as a musical chord progression.
Theory
The script uses a standard formula to convert frequency in Hertz (Hz) to a MIDI note number (and then cents):
MIDI Note = 69 + 12 * log2(Frequency / 440)
The four formants (F1-F4) are used to represent a four-part chord:
- F1 (typically the lowest): Often corresponds to vowel height and forms the bass or root of the chord.
- F2 (second lowest): Often corresponds to vowel backness/frontness and forms the next voice in the chord.
- F3 & F4: Provide upper harmonics and contribute to the timbral quality of the resulting musical chord.
Quick start
- In Praat, select exactly one Sound object (preferably speech or a sustained vocalization).
- Run script… →
FormantToMidiChordConverter.praat. - Adjust the Number of segments to control the time resolution (more segments = finer time slices).
- Click OK.
- The results, showing the four-part chord analysis for each time segment, are printed in the Praat Info window.
Parameters (form fields)
| Name (GUI) | Type | Default | Description |
|---|---|---|---|
| Number of segments | positive integer | 8 | The number of equally-sized time segments the input sound will be divided into for analysis. |
| Time step | positive real | 0.01 | The time step (in seconds) used to create the internal Formant object. Finer steps provide more detail but take longer. |
| Max formant Hz | positive real | 5500 | The maximum frequency (in Hz) the formant tracker will look for formants. Set higher for high-pitched sounds or lower for deep voices. |
| Number of formants | positive integer | 5 | The number of formants the internal Praat object will attempt to track. The script itself only uses the first 4 (F1-F4). |
| Window length | positive real | 0.025 | The duration (in seconds) of the analysis window used by the Burg algorithm for formant estimation. |
Outputs
The script does not create a new object in the Praat Objects window. All results are printed to the Praat Info window.
The output for each segment includes:
- Time range of the segment.
- Analysis point (midpoint of the segment).
- For each of the first four formants (F1-F4):
- The frequency in Hertz (Hz).
- The frequency converted to MIDI cents.
- The closest standard musical note (e.g., C4) and the cents deviation (e.g., +15¢).