bark-speaker-directory icon indicating copy to clipboard operation
bark-speaker-directory copied to clipboard

how to add voice to the bark model

Open WenchenLi opened this issue 1 year ago • 1 comments

appriciete the work can you show me the code how to import the Warriors into the bark model

WenchenLi avatar Jun 25 '23 16:06 WenchenLi

Download an NPZ file, then load it into a dictionary:

def load_npz(filename):
    with np.load(filename, allow_pickle=True) as data:
        result = {key: data[key] for key in data}
        return result

after that pass it as an argument to the bark.generate function as:

from models.bark.bark import generate_audio

generate_audio(... history_prompt=load_npz("./your-npz-file.npz"), ...)

This code be seen here: https://github.com/rsxdalv/tts-generation-webui/blob/8222a2fe29beec1cd0ee64333f7b944d520fe276/src/bark/npz_tools.py#L29 https://github.com/rsxdalv/tts-generation-webui/blob/3c1764701dbf646a1c03c37017cc5c21d17cc7de/src/bark/generation_tab_bark.py#L57

Or you can use a Bark UI that supports voices, such as mine - https://github.com/rsxdalv/tts-generation-webui or https://github.com/JonathanFly/bark

rsxdalv avatar Jun 26 '23 07:06 rsxdalv