Mehr reden
This commit is contained in:
@ -11,6 +11,7 @@ using OpenAI_API.Models;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Google.Cloud.TextToSpeech.V1;
|
||||
|
||||
[Serializable]
|
||||
public class TextToSpeechResponse
|
||||
@ -21,12 +22,22 @@ public class TextToSpeechResponse
|
||||
|
||||
public class Text2Speech : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public string context = "going for a walk, falling, explosion, blood";
|
||||
[SerializeField]
|
||||
public string gender = "MALE";
|
||||
[SerializeField]
|
||||
public JToken voice = null;
|
||||
[SerializeField]
|
||||
public double speakingSpeed = 1.1;
|
||||
[SerializeField]
|
||||
public bool playSound = false;
|
||||
[SerializeField]
|
||||
public bool generate = false;
|
||||
[SerializeField]
|
||||
public bool newVoiceAndGenerate = false;
|
||||
[SerializeField]
|
||||
public string Voice;
|
||||
|
||||
private AudioSource _audioSource;
|
||||
|
||||
@ -60,6 +71,7 @@ public class Text2Speech : MonoBehaviour
|
||||
{
|
||||
GetRandomGermanVoice(gender, (v) => {
|
||||
voice = v;
|
||||
Voice = voice.ToString();
|
||||
//Debug.Log($"GoogleCloud: Choosen voice is\n{voice}");
|
||||
StartCoroutine(GenerateAndSynthesizeText(context));
|
||||
});
|
||||
@ -69,6 +81,13 @@ public class Text2Speech : MonoBehaviour
|
||||
StartCoroutine(GenerateAndSynthesizeText(context));
|
||||
}
|
||||
}
|
||||
if (newVoiceAndGenerate)
|
||||
{
|
||||
newVoiceAndGenerate = false;
|
||||
voice = null;
|
||||
Voice = null;
|
||||
generate = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Generate(string c)
|
||||
|
||||
Reference in New Issue
Block a user