KoljaB / AIVoiceChat

Low latency ai companion voice talk in 60 lines of code using faster_whisper and elevenlabs input streaming
250 stars 48 forks source link

Elevenlabs custom voice #9

Open Tobe2d opened 10 months ago

Tobe2d commented 10 months ago

I would like to add elevenlabs custom voice based on id and name. custom voice = cloned own voice ;-)

Hope you can help me on this

KoljaB commented 10 months ago
from elevenlabs import voices, generate, stream

        voice_object = Voice.from_id(id)
        voice_object.settings = VoiceSettings(
            stability=self.stability / 100,
            similarity_boost=self.clarity / 100,
            style=self.style_exxageration / 100,
            use_speaker_boost=True
        )

        audio_stream = generate(
            text=generator,
            voice=voice_object,
            model=model,
            stream=True
        )

        stream(audio_stream)

Roughly like this, hope that helps. Note that streaming only works with the v1 models.

KoljaB commented 10 months ago

Sry needs this too: from elevenlabs.api import Voice, VoiceSettings

Tobe2d commented 10 months ago

Thanks for the reply,

I am getting this error:

Start speaking. I'm all ears.

Can you hear me? <<< Traceback (most recent call last): File "E:\Ai__Project\AIVoiceChat\voice_talk_vad.py", line 63, in voice_object = Voice.from_id(o6y7W8Np) ^^^^^^^^^^^^^^^^^^^^ NameError: name 'o6y7W8Np' is not defined

KoljaB commented 10 months ago

Pls try: voice_object = Voice.from_id("o6y7W8Np")

Tobe2d commented 10 months ago

Moving step ahead.

another error:

NameError: name 'self' is not defined

seems I need to add the name of the model somewhere as it is named in elvenlabs

KoljaB commented 10 months ago

Replace model with "eleven_monolingual_v1" and the self.stability etc with a value between 0 and 100

KoljaB commented 10 months ago

Or eleven_multilingual_v1. V2 models dont work with stream.