tijo95 / piper_tts

Synthèses vocale piper oobabooga
10 stars 2 forks source link

Not working on Windows (and my solution) #11

Closed Simplegram closed 7 months ago

Simplegram commented 7 months ago

My piper_tts is not working out of the box because the config parameter (-c or --config) is needed. The solution from #10 didn't work for me so I added a few lines of code on line 78 based on this thread. Maybe address this on future updates?

def tts(text, output_file):
    cleaned_text = clean_text(text)
    print(f"tts: {cleaned_text} -> {output_file}")

    selected_model = params.get('selected_model', '')
    model_path = model_folder / selected_model
    config_path = model_folder/ f'{selected_model}.json'

    output_file_path = output_folder / output_file
    output_file_str = output_file.as_posix()

    process = subprocess.Popen(
        [
            piper_path.as_posix(),
            '--sentence_silence', str(params['sentence_silence']),
            '--noise_scale', str(params['noise_scale']),
            '--length_scale', str(params['length_scale']),
            '--noise_w', str(params['noise_w']),
            '--speaker', str(params['speaker_id']),
            '--model', model_path.as_posix(),
            '--config', config_path.as_posix(),
            '--output_file', output_file_str,
            '--quiet' if params['quiet'] else '',
        ],
        stdin=subprocess.PIPE, 
        text=True
    )

    process.communicate(input=cleaned_text)
Martin-Laclaustra commented 7 months ago

I added your changes. Please re-open the issue if the most recent version in the repo still has problems.

Simplegram commented 7 months ago

I can confirm the most recent version works. Thank you!

tijo95 commented 7 months ago

Hi everyone, thank you for your interest in a project. Currently, due to lack of time, I cannot respond to your requests. As soon as possible I'm going to dive back into the code. the contributor Martin-Laclaustra is active on the project he has already carried out quite a few fixes it seems to me, so a big thank you to him.