This repository contains the code for analyzing the modulation spectrum.
- Download the audio file and its transcription
- Convert audio file to .wav format with ffmpeg by setting -ac to 1, -ar to 16000
- Align and obtain the .TextGrid file with .wav & .txt file by MFA
The modulation spectrogram and spectrum can be calculated by the three function below in the model-test.py
script.
# modulation spectrogram
_ = test_spectrogram_generate()
# broadband spectrum
peak_freq = test_spectrum_generate(bandwidth='broad')
# narrowband spectrum
peak_freq = test_spectrum_generate(bandwidth='narrow')
Three kinds of rate of syllable can be calculated by the three function below in the model-test.py
script.
# syllable rate
syll_rate = test_rate_of_syllable_generate(rate_type='sr')
# articulation rate
syll_rate = test_rate_of_syllable_generate(rate_type='ar')
# syllable mode
syll_rate = test_rate_of_syllable_generate(rate_type='mode')
# correlation
demo_of_modeling_relationship_between_syllable_rate_and_modulation_spectrum(data_path='./assets')
# TRF
demo_of_modeling_relationship_between_syllable_onset_and_broadband_envelope(data_path='./assets')