Created
December 27, 2021 17:47
-
-
Save tatmos/0c13fcacad68c173c1c67fe69297a653 to your computer and use it in GitHub Desktop.
VOICEVOXの音声合成をするpythonスクリプト(VOICEVOXを起動した状態で実行)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import requests | |
import json | |
text = open('text.txt', encoding='utf-8').read() | |
#text = 'あいうえお' | |
query1 = requests.post('http://localhost:50021/audio_query', params={'speaker': '1', 'text': text}) | |
#print(json.dumps(query1.json(), indent=2)) | |
query2 = requests.post('http://localhost:50021/synthesis', headers={'content-type': 'application/json'},\ | |
params={'speaker': '1'}, data=json.dumps(query1.json())) | |
with open('a.wav', mode='wb') as f: | |
f.write(query2.content) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
関連
https://github.com/VOICEVOX/voicevox_engine