using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class tts : MonoBehaviour
{
public AudioSource audioSource;
// Start is called before the first frame update
void Start()
{
audioSource = gameObject.GetComponent<AudioSource>();
StartCoroutine(DownloadTheAudio());
}
IEnumerator DownloadTheAudio()
{
// SampleText 에 원하는 글 넣으면 됨
// En-gb 한국어로 하고싶으면 Ko-gb 하니까 됨
string url = "https://translate.google.com/translate_tts?ie=UTF-8&total=1&idx=0&textlen=32&client=tw-ob&q=SampleText&tl=En-gb";
WWW www = new WWW(url);
yield return www;
audioSource.clip = www.GetAudioClip(false,true, AudioType.MPEG);
audioSource.Play();
}
}
댓글 없음:
댓글 쓰기