def GenerateAudio(Voice, Text):
voiceDir = f"./NexusVoice/Voices/{Voice}"
if os.path.realpath(voiceDir):
AudioPath = os.path.join(voiceDir,"audio.wav")
if not os.path.realpath(AudioPath):
return
audioSample = chat.sample_audio_speaker(wave_read(AudioPath))
InferParams = chat.InferCodeParams(
top_P = 0.7,
top_K = 20,
spk_smp= audioSample,
txt_smp = open(os.path.join(voiceDir,"Transcription.txt")).read(),
)
RefineParams = chat.RefineTextParams(
top_P = 0.7,
top_K = 20,
)
print(Text)
AudioFile = chat.infer(
Text,
params_infer_code = InferParams,
params_refine_text = RefineParams,
)
torchaudio.save("word_level_output.wav", torch.from_numpy(AudioFile[0]).unsqueeze(0), 24000)
above is the code I am using for it please ask if you want any more details
above is the code I am using for it please ask if you want any more details