LoginSignup
1
0

More than 1 year has passed since last update.

ポエトリーリーディングする

Last updated at Posted at 2021-12-17

ポエトリーリーディングとは

ポエトリーリーディング (英語: poetry reading) は、主に詩人が自作の詩を読み上げる行為を指すが、20世紀後半からは特にライブハウスなどの会場で詩を朗読するパフォーマンスを意味する場合が多い。ラップミュージックにのせて詩を読むという形態もある。

ポエトリーリーディング 出典: フリー百科事典『ウィキペディア(Wikipedia)』

やってみる

テキストから読み上げ音声を作って音楽にのせる

googleのText-to-Speechが読み上げてくれるらしいからこれ使ってみる、
なんか1ヶ月400万文字まで無料なんだってさ。

Google Cloud Platformのアカウント作ってText-to-Speech APIを使うためのキー発行あるんだけどなかなか大変だった、以下を参考にしました。


text = "読ませるテキスト"

voice_path="voice.mp3"
motoneta_path="motoneta.mp3"


import os
from pydub import AudioSegment
from google.cloud import texttospeech

os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'GCPで生成したキーファイルが置いてあるパス'


# Text-to-Speechを使う設定
client = texttospeech.TextToSpeechClient()
synthesis_input = texttospeech.SynthesisInput(text=text)
voice = texttospeech.VoiceSelectionParams(
    name="ja-JP-Standard-B",
    language_code="ja-JP",
    ssml_gender=texttospeech.SsmlVoiceGender.NEUTRAL
)
audio_config = texttospeech.AudioConfig(
    audio_encoding=texttospeech.AudioEncoding.MP3
)

# 音声変換
response = client.synthesize_speech(
    input=synthesis_input, voice=voice, audio_config=audio_config
)
with open(voice_path, "wb") as out:
    out.write(response.audio_content)

# 音声ができたから元ネタに重ねる
motoneta = AudioSegment.from_file(motoneta_path, format="mp3")
voice = AudioSegment.from_file(voice_path, format="mp3")

motoneta = motoneta.overlay(voice, 0)
motoneta.export("poem.mp3", format="mp3")

おしまい

texttospeechについてはほぼサンプルソースまるパクリ

聞いてみた

どうしようもない

実は声だけちょっと音量上げちゃった。

ちょっと遅くもしてみた

よくわからん

テキストの元ネタはこれ

感想

多分自分はポエトリーリーディングを勘違いしている。

今後の展開

BPM合わせてボイスの後ろをディレイで飛ばすとかしたい、ダブディレイ的なの

その他

日本語の発音が滑らかな感じだからTextToSpeech使ったけど、
Open-Jtalk使うと壊れた電報みたいな感じになるし
pyttsx3使うと破壊の限りを尽くされるのでそれはそれでいいと思う

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0