maxime-fleury / SillyTavern-Piper-TTS

6 stars 0 forks source link

How to load and add custom trained voices? #2

Open FemBoxbrawl opened 4 months ago

FemBoxbrawl commented 4 months ago

I have no idea how to add custom Voice models. can you explain how to do that? i have the libritts model, and can choose from the available voices. but I want to add my own trained ones.

maxime-fleury commented 4 months ago

You have a file named voices.yaml, it's the configuration files for voices, in the index.js you have those lines:

let MODELS = [];
    MODELS['en'] = path.join(__dirname, 'models', 'en_US-libritts_r-medium.onnx');
    MODELS['fr'] = path.join(__dirname, 'models', 'fr_FR-upmc-medium.onnx');

let defaultVoices = [];
    defaultVoices['en'] = 115;
    defaultVoices['fr'] = 0;

So if you have multispeaker model you can put it in the folder models, and edit those lines, then in voices.yaml you can select the ID of the voices you want and the name of the voices, in the case your model only has one voice you can edit this line:

  return `${echoCommand} '${text}' | ${piperExecutable} -m ${MODELS[LANG]} -s ${voiceId} -f ${outputFile}`;

look in the documentation of piper tts how should you exec without voice id it should be really easy, if you are brave enough you can edit the index.js file and the voices.yaml file so you the extension can nativaly handle monospeaker models.