Montreal Forced Aligner

Author(s) orcid logoJessica Wallace avatar Jessica Wallace
Tester(s) orcid logoDaniela Schneider avatar Daniela Schneider
Reviewers Daniela Schneider avatar
Overview
Creative Commons License: CC-BY Questions:
  • How can you use Montreal Forced Aligner to align an audio and a TextGrid file in Galaxy?

Objectives:
  • Use the Montreal Forced Aligner to break down speech into its smallest sounds and align them with their corresponding transcription.

Time estimation: 1 hour
Level: Introductory Introductory
Supporting Materials:
Published: Jul 22, 2026
Last modification: Jul 22, 2026
License: Tutorial Content is licensed under Creative Commons Attribution 4.0 International License. The GTN Framework is licensed under MIT
version Revision: 1

This tutorial explains how to use the Montreal Forced Aligner (MFA) McAuliffe et al. 2017 on the Galaxy platform.

The aligner breaks down speech into its smallest possible sounds (phones) and aligns the indivdual sounds to their corresponding orthographic transcription. For example, the word ‘fox’ is broken down into four sounds: F AA K S or /f ɑː k s/ (depending on whether you use ARPAbet or IPA for the transcription). The phonetic transcription of each sound is given a precise time boundary to match it to the corresponding sound in the audio file. Each sound can then be analyzed individually without the need for lengthy manual segmentation. For example, researchers can then measure and compare each pronunciation of a certain sound in very little time.

To achieve this, MFA has acoustic models and pronunciation dictionaries for numerous languages, which can be selected in Galaxy.

The tool requires an audio or video file and an orthographic transcription as a TextGrid file. Audio can be transcribed using e.g. Elan Wittenburg et al. 2006 or Praat Boersma 2001. Speech should be segmented into breath groups (the speech in between two breaths) and the transcript exported as a TextGrid. The audio file and TextGrid should then be compressed into one .zip file to be uploaded into Galaxy.

Agenda

In this tutorial, we will cover:

  1. Preprocessing
    1. Required data formats
    2. Data Validation Checklist
    3. Uploading the data
  2. Align the files
    1. Sub-step with MFA Find OOVs
    2. Sub-step with Unzip
    3. Sub-step with MFA G2P
    4. Sub-step with MFA Merge
    5. Sub-step with MFA Align
    6. Downloading and Exporting Results
  3. Next Steps and Use Cases
  4. Conclusion

Preprocessing

Audio or video files must first be segmented and transcribed using e.g. Elan Wittenburg et al. 2006 or Praat Boersma 2001 and the transcript exported as a TextGrid (alternatively as a .lab/.txt file but these must be pasted in as a single line). The TextGrid should contain a single tier with short intervals (a breath gorup). Each interval should correspond to an utterance in the audio file. The tier name can be a speaker ID (though this is not necessary).

Required data formats

The filenames of the audio/video file and the transcript must be identical except for the extension (e.g. .wav or .TextGrid). It is helpful to have the speaker ID prefix to the filename (e.g. JW_interview.wav, JW_interview.TextGrid), then you can instruct the aligner to use the corresponding number of characters (2 in the previous example) as the speaker information. This speaker ID will be retained in the output, allowing you to later identify and analyze speech patterns by speaker.

These should then be compressed into one .zip file to be uploaded into Galaxy.

Data Validation Checklist

Before uploading, verify your files meet these requirements:

  • param-check Audio file and TextGrid have identical base filenames (e.g., JW_interview.wav and JW_interview.TextGrid)
  • param-check Audio format is WAV or MP3 (WAV is best for quality)
  • param-check TextGrid contains a single tier with short intervals, each representing one breath group
  • param-check Transcription text matches the actual spoken content (typos will cause alignment errors)
  • param-check Speaker ID prefix is consistent, if present (e.g. all files start with 2-3 character speaker code)
  • param-check Files are compressed into a single .zip archive

The following example file matches the above criteria and will be used in the next steps.

Uploading the data

Hands On: Data Upload
  1. Create a new history for this tutorial
  2. Import your files or if you want to follow the tutorial use the files from Zenodo or from the shared data library (GTN - Material -> digital-humanities -> Montreal Forced Aligner):

    https://zenodo.org/records/21371207/files/the_fox_and_the_grapes.zip?download
       
    
    • Copy the link location
    • Click galaxy-upload Upload at the top of the activity panel

    • Select galaxy-wf-edit Paste/Fetch Data
    • Paste the link(s) into the text field

    • Press Start

    • Close the window

    Galaxy upload link

    As an alternative to uploading the data from a URL or your computer, the files may also have been made available from a shared data library:

    1. Go into Libraries (left panel)
    2. Navigate to the correct folder as indicated by your instructor.
      • On most Galaxies tutorial data will be provided in a folder named GTN - Material –> Topic Name -> Tutorial Name.
    3. Select the desired files
    4. Click on Add to History galaxy-dropdown near the top and select as Datasets from the dropdown menu
    5. In the pop-up window, choose

      • “Select history”: the history you want to import the data to (or create a new one)
    6. Click on Import

  3. Rename the datasets to a more meaningful name (optional):
    • Click on the dataset produced by MFA Find OOVs
    • Click the galaxy-pencil (edit) icon
    • Choose a meaningful name, for example, the_fox_and_the_grapes.zip
  4. Change the datatype of the dataset to mfa_corpus_model.zip

    • Click on the galaxy-pencil pencil icon for the dataset to edit its attributes
    • In the central panel, click galaxy-chart-select-data Datatypes tab on the top
    • In the galaxy-chart-select-data Assign Datatype, select datatypes from “New Type” dropdown
      • Tip: you can start typing the datatype into the field to filter the dropdown menu
    • Click the Save button

Align the files

Before we align the files, we need to first check whether all of the words are in our dictionary. MFA offers the Find OOVs (out of vocabulary words) tool to do this.

Sub-step with MFA Find OOVs

Hands On: Find out-of-vocabulary words
  1. MFA Find OOVs with the following parameters:
    • param-file “Corpus Archive”: the_fox_and_the_grapes.zip (Uploaded dataset)
    • “Dictionary Source”: Use a built-in MFA Dictionary
      • “Select Dictionary”: English Us (ARPA)
    • “Speaker Characters”: 0
  2. Rename the output file for clarity:
    • Click on the dataset you uploaded
    • Click the galaxy-pencil (edit) icon
    • Change the name to OOVs_english_us or similar
    • This will help you identify this as the out-of-vocabulary words file

Expected output: A .zip file containing a text file (oovs_found_english_us_arpa.txt) listing all words from your transcription that are not in the English US ARPA dictionary. If no OOVs are found, the file will be empty (if that is the case, you can skip the next three steps and go straight to MFA Align).

Sub-step with Unzip

In order to generate the pronunciations of the OOVs, we need the single file oovs_found_english_us_arpa.txt. We therefore need to unzip the output of Find OOVs so we can work with the file. The missing pronunciations can be generated automatically in the next step (MFA G2P) or manually using the editor.

Hands On: Unzipping your file
  1. Unzip a file ( Galaxy version 6.0+galaxy5) with the following parameters:
    • param-file “Input file”: OOVs_english_us (output of MFA Find OOVs tool)
    • “What to extract”: Single file
      • “File path”: oovs_found_english_us_arpa.txt
  2. Rename the output file for clarity:
    • Click on the dataset produced by MFA Find OOVs
    • Click the galaxy-pencil (edit) icon
    • Change the name to unknown_words or similar
    • This will help you identify this as the out-of-vocabulary words file
    Comment: Check the OOVs

    Double-check the OOVs found file and make sure that none of the OOVs are typos. To do so, click on the galaxy-eye icon next to the dataset name to look at the file. If you do find a typo, you must correct this in the transcription, then upload the .TextGrid again and rerun the previous steps.

Sub-step with MFA G2P

Now we can generate pronunciations for each of the out of vocabulary words using MFA’s built in grapheme-to-phoneme (G2P) tool. Select the same model you used for finding OOVs.

Hands On: Generate pronunciations with G2P
  1. MFA G2P with the following parameters:
    • “Input Mode”: Word List (Text File)
      • param-file “Word List”: unknown_words (output of Unzip tool)
    • “G2P Model Source”: Use a built-in MFA Model
      • “Select G2P Model”: English Us (ARPA)
    Comment: Check the pronunciations manually

    It is important to check the pronunciations manually. MFA can also offer multiple possible pronunciations for each word. Correct any incorrect pronunciations and delete any additional pronunciations that do not apply. To do so, you can use the editor which can be found in Visualization on the side bar. There you can select the generated dictionary and correct the pronunciation.

    This tutorial uses ARPAbet phonetic notation for US English (e.g., AE, IH, K). Other models use IPA, which is the international standard for most other languages and varieties.

  2. Rename the output file for clarity:
    • Click on the output_dictionary dataset produced by MFA G2P
    • Click the galaxy-pencil (edit) icon
    • Change the name to generated_pronunciations_oovs or generated_dictionary
    • This clearly identifies this as the file containing generated pronunciations for OOV words

Expected output: A dictionary file in MFA format (one entry per line: word followed by phonetic transcription). File size depends on the number of OOVs.

Sub-step with MFA Merge

Now we will add the new words to the built-in dictionary so that they are recognized when we run the aligner.

Hands On: Add new words to your dictionary
  1. MFA Merge with the following parameters:
    • “Dictionary Source”: Use a built-in MFA Dictionary
      • “Select Dictionary”: English Us (ARPA)
    • In “Dictionary to add”:
      • param-repeat “Insert Dictionary to add”
        • param-file “MFA dictionary”: generated_pronunciations_oovs (output of MFA G2P tool)
    Comment: If corrections were uploaded

    If you uploaded a file with corrected pronunciations, you will have to select the uploaded file with the corrected dictionary entries as your dictionary to add.

  2. Rename the output file for clarity:
    • Click on the output dataset produced by MFA Merge
    • Click the galaxy-pencil (edit) icon
    • Change the name to updated_dictionary_english_us or merged_dictionary
    • This clearly identifies this as the merged dictionary containing both built-in entries and newly generated pronunciations

Expected output: A merged dictionary file (single file, not a .zip) containing all entries from the built-in English US ARPA dictionary plus your newly generated pronunciations for OOV words. This is the complete dictionary your audio will be aligned against.

Sub-step with MFA Align

Now we’re ready to align the pronunciations with the audio. Since we only have one spekaer and no spekaer ID, we leave the number of spekaer characters at 0. If you have a spekaer ID at the start of your file name, then select the number of characters corresponding to the speaker ID.

Hands On: Align Audio and Pronounciation
  1. MFA Align with the following parameters:
    • param-file “Corpus Archive”: the_fox_and_the_grapes.zip (Input dataset)
    • “Dictionary Source”: Upload from History
      • param-file “Dictionary File”: updated_dictionary_english_us (output of MFA Merge tool)
    • “Acoustic Model Source”: Use a built-in MFA Model
      • “Select Acoustic Model”: English Us (ARPA)
    Comment: Check the output in Praat

    Always validate the alignment output:

    1. Download the .TextGrid file from the output archive (see steps below)
    2. Open the original audio file + aligned TextGrid together in Praat
    3. Check: Do the boundaries align with the actual speech transitions?
    4. Listen for obvious misalignments: does silence have phoneme labels? Are vowels properly segmented?
    5. Minor misalignment is normal, but if you have more serious or widespread errors, check your transcription or OOVs

    Praat playback tip: Right-click on a TextGrid interval and select “Play” to hear just that phoneme segment.

  2. Rename the output file for clarity:
    • Click on the output archive produced by MFA Align
    • Click the galaxy-pencil (edit) icon
    • Change the name to aligned_textgrids or mfa_output_aligned
    • This clearly identifies this as the final aligned output containing the TextGrid files with time boundaries for each phoneme

Expected output: A .zip archive containing TextGrid files (one per input file) with three tiers: words, phones (individual sounds), and word confidence scores. Total runtime depends on audio length.

Downloading and Exporting Results

Hands On: Extract and download your aligned files
  1. Download the aligned archive:
    • Click the download icon (download) next to the aligned_textgrids dataset
    • Save the .zip file to your computer
  2. Extract the files on your computer

  3. Open in Praat for analysis:
    • In Praat, open the original audio file (File → Open → Read from file…)
    • Then open the corresponding TextGrid (Objects window → Read → Read from file…)
    • Select both and click “View & Edit” to visualize the alignment

Next Steps and Use Cases

Once you have aligned TextGrids, you can:

  • Measure vowel formants: Extract and analyze vowel characteristics from aligned vowel intervals. To do so, you can use new-fave.
  • Compare pronunciations: Analyze variation across speakers or time
  • Assess speech rate: Measure duration of phonemes or words to study articulation speed
  • Study consonant voicing: Use the precise time boundaries to measure voice onset time (VOT)

Conclusion

In this tutorial, we uploaded a sample audio file and transcription. We checked for any out-of-vocabulary words (OOVs) missing from our dictionary and generated the pronunciations using G2P. After checking and, if necessary, correcting these pronunciations, we merged the generated pronunciations with the built-in dictionary and ran the aligner on our files, producing aligned TextGrid files with precise phoneme-level time boundaries.

You now have a fully aligned and labeled corpus ready for phonetic analysis.