본문 바로가기
Youtube

음성 tts - gcloud 사용해보기

by OKOK 2024. 6. 9.
  • set PATH=%PATH%;C:\Users\lion\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin
  • gcloud init
  • gcloud 사용해서 studio 음성 사용하기
  • 4000문장에 $16이니
  • 1000문장을 만들수 있음
  • 한번에 30개 잡으면
  • 300개 영상을 만들고 2만원을 내는 꼴
  • 한번 영상을 제작해보기
  • 아래 python 기본 동작 확인 완료
"""Synthesizes speech from the input string of text or ssml.
Make sure to be working in a virtual environment.

Note: ssml must be well-formed according to:
    https://www.w3.org/TR/speech-synthesis/
"""
from google.cloud import texttospeech

# Instantiates a client
client = texttospeech.TextToSpeechClient()

# Set the text input to be synthesized
synthesis_input = texttospeech.SynthesisInput(text="Hello, World!")

# Build the voice request, select the language code ("en-US") and the ssml
# voice gender ("neutral")
voice = texttospeech.VoiceSelectionParams(
    language_code="en-US", ssml_gender=texttospeech.SsmlVoiceGender.NEUTRAL
)

# Select the type of audio file you want returned
audio_config = texttospeech.AudioConfig(
    audio_encoding=texttospeech.AudioEncoding.MP3
)

# Perform the text-to-speech request on the text input with the selected
# voice parameters and audio file type
response = client.synthesize_speech(
    input=synthesis_input, voice=voice, audio_config=audio_config
)

# The response's audio_content is binary.
with open("output.mp3", "wb") as out:
    # Write the response to the output file.
    out.write(response.audio_content)
    print('Audio content written to file "output.mp3"')

'Youtube' 카테고리의 다른 글

facefusion concensor  (0) 2024.07.14
unsampling hotshot xl / anidiff xl  (0) 2024.07.01
음성 tts  (0) 2024.05.25
Bark TTS  (0) 2024.04.21
ffmeg wav파일 합치기  (1) 2024.02.04

댓글