some-script-to-help-using-Montreal-Forced-Aligner
some-script-to-help-using-Montreal-Forced-Aligner copied to clipboard
Some script for helping using Montreal Forced Aligner, maily for transforming Hanzi character to pinyin and extrat pause time from .textgrid files.
some-script-to-help-using-Montreal-Forced-Aligner
Some script for helping using Montreal Forced Aligner,
- mainly for transforming Hanzi character to pinyin,
- generating phone dict,
- train your own model
- and extrat pause time from .textgrid files.
In this project, I use Common Voice Chinese dataset as example. After extrating dataset.zip, please move clips directory to the path contains common-voice-dataset-hanzi2pinyin.py file. Then rename clips to data. Also make sure that zh-CN in that path.
Before traing with MFA(Montreal-Forced-Aligner)
0_common-voice-dataset-hanzi2pinyin.py, will generate.labfiles indatadir.1_trans_mp3_to_wav_and_move_mp3_to_another.py. Because Montreal-Forced-Aligner does not fit.mp3for training, I transformed it to.wavand moved.mp3todata_mp3.- Option.
1_copy_lab_to_data_mp3.py 2_wav_subsample_to_16000.py, original.wavhas many differnt speaker ratio. Using this scrip to change ratio.3_use_mfa_make_dict.sh, generate a dictionary of pinyin phone. Make sure you set the right path parameter in.sh.
Doing a training
4_use_mfa_train_align_model.sh, Training. Make sure you set the right path parameter in .sh.
After traing, to produce pause time
5_1_process_textgrid_mid_as_sp.py, usespandsilgenerated by MFA to extract pause time.- Or,
5_2_process_textgrid_only_sp.py, use the middle timepoint of the every character to compute a difference time of two neighbor character.