音声を生成
環境構築
参考
https://qiita.com/yuuuka/items/953ad06a7bf4419df875
python 3.1 でしか動かないので、pythonを切り替えられるようにする。
https://pythonlinks.python.jp/ja/index.html
こっから3.1をもらってくる。
PS C:\Users\h\OneDrive\デスクトップ> py --list
Installed Pythons found by C:\Windows\py.exe Launcher for Windows
-3.12-64 *
-3.10-64
-3.9-64
とりあえず、切り替えができるようになっていたら次へ
git clone https://github.com/Plachtaa/VALL-E-X.git
cd VALL-E-X
py -3.10 -m pip install -r requirements.txt
py -3.10 -m pip install IPython
checkpointsフォルダを作成し、vallex-checkpoint.ptを入れる
whisperフォルダを作成し、medium.ptを入れる
生成
utf-8 で作る
hoge.py
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
from scipy.io.wavfile import write as write_wav
from IPython.display import Audio
# download and load all models
preload_models()
# generate audio from text
text_prompt = """今日はとても暑いですね。みんなが笑顔になりますように"""
audio_array = generate_audio(text_prompt)
# save audio to disk
write_wav("vallex_generation.wav", SAMPLE_RATE, audio_array)
# play text in notebook
Audio(audio_array, rate=SAMPLE_RATE)
実行
py -3.10 hoge.py
vallex_generation.wavができあがる
応用
声を変えて、さらにファイル名を連番にする
hoge.py
import time
from utils.generation import SAMPLE_RATE, generate_audio, preload_models
from scipy.io.wavfile import write as write_wav
from IPython.display import Audio
# download and load all models
preload_models()
# generate audio from text
text_prompt = """今日はとても暑いですね。みんなが笑顔になりますように"""
audio_array = generate_audio(text_prompt,prompt="esta")
timestamp = int(time.time())
filename = f"vallex_generation_{timestamp}.wav"
# save audio to disk
write_wav(filename, SAMPLE_RATE, audio_array)
# play text in notebook
Audio(audio_array, rate=SAMPLE_RATE)