Sentence mixing
Project description
Sentence mixing
This library is used to analyze and smartly reorder phonems of an audio sequence to form any desired sentence.
The goal of this library is to generate Sentence Mixing Youtube poops (example).
Entry file is sentence_mixer.py
.
Here is are examples of applications based on the library:
MFA
SM library is using Montreal Forced Aligner, a powerful tool used to timestamp words and phonems in a subtitled audio file.
Installing MFA
MFA is kind of hard to install. You can download the builded release, but to use it, you should have python3.6.
Otherwise, we prepared a tutorial to build it from source:
- Download release source code 1.0.1
- Extract it as
Montreal-Forced-Aligner
- Install all python modules listed in
requirements.txt
- Install kaldi (available in pacman's repo Arch4edu)
- In folder
Montreal-Forced-Aligner/freezing
, runfreeze.sh
- In folder
Montreal-Forced-Aligner/thirdparty
, run the following command:python kaldibinaries.py /opt/kaldi
- Copy every file from
/opt/kaldi/src/featbin
toMontreal-Forced-Aligner/thirdparty/bin
- Move
align.py
fromMontreal-Forced-Aligner/aligner/command_line
toMontreal-Forced-Aligner/
JSON config file
To use the library, you have to provide a json configuration file. Here are all the fields to add into it:
dict_path
: Path to dictionnary file. This dictionnary associates every words of a language to associated phonemsalign_exe
: MFA executable filetrained_model
: pre-trained model MFA will use. Should be a ZIP file.lang
: language. Only 'fr' is supported nowdict_consonant_vowel_path
: Path to dictionary declaring the consonant and vowel phonemsfolder
: Folder where the Youtube subtitles will be stored
This config file should be passed through the function prepare_sm_config_file
Recommended config.json
dict_path
: For french users, usefr.dict
from SM-Dictionaries repoalign_exe
: Write a tiny shell script that- Adds
Montreal-Forced-Aligner/thirdparty/bin/
to your path - Runs
python Montreal-Forced-Aligner/align.py $@
- Adds
trained_model
: Choose one of the MFA pretrained model. For french users, use prosodylab version.dict_consonant_vowel_path
: For french users, usefr_consonant_vowel.dict
from SM-Dictionaries repo
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sentence_mixing-1.1.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f32fe7606fb5ffd8f7c81ee10b307336a9d7d1ab71ce6392e8fa5ff78c64dd1e |
|
MD5 | ee93e33eebb9d721e585d70e0ee7aae7 |
|
BLAKE2b-256 | 9db3ee73464ee64711651869dd90eb7dc4d0d32a6f876777b13616a3045b034d |