Skip to content

When sampling speaker, it gives me a weird version of my sample audio #837

@sfgij

Description

@sfgij
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationstaleThe topic has been ignored for a long timeuiUI improvements & issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions