rhasspy / piper

A fast, local neural text to speech system
https://rhasspy.github.io/piper-samples/
MIT License
6k stars 435 forks source link

TypeError: PiperVoice.__init__() missing 1 required positional argument: 'config' #614

Open ghost opened 1 week ago

ghost commented 1 week ago

When trying to initialize the model, I get the following error message:

Traceback (most recent call last): File "/home/jedd/jarvis/jv.py", line 19, in voice = PiperVoice(model) ^^^^^^^^^^^^^^^^^ TypeError: PiperVoice.init() missing 1 required positional argument: 'config'

Raspberry Pi 5 - 8GB PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian

Model Files en_US-lessac-medium.onnx
en_US-lessac-medium.onnx.json

en_US-lessac-medium.onnx.json

import os
from dotenv import load_dotenv
import time
import speech_recognition as sr
import pyttsx3
from piper.voice import PiperVoice
import numpy as np
import sounddevice as sd

load_dotenv()
model = "/home/jedd/jarvis/en_US-lessac-medium.onnx.json"
voice = PiperVoice(model)
text = "This is an example of text to speech"
wav_file = wave.open(“output.wav”, “w”)
audio = voice.synthesize(text, wav_file)
ghost commented 1 week ago

the PiperVoice(model) syntax is wrong - it should be as follows:

PiperVoice.load(model)