Skip to content

How to get the Female voice in text-to-speech? #496

@kotnibf

Description

@kotnibf

I am using the built-in feature for text-to-speech (speechSynthesis)
I need the Female voice and I got that using voiceUrl: Google US English
But that speaks only about 2 sentences.
What is the problem?

This is my Next.js Code

        const utterance = new SpeechSynthesisUtterance(message.content);
        // const voices = speechSynthesis.getVoices().filter(voice => voice.lang.startsWith("en") && voice.name.includes('Female'));
        console.log(speechSynthesis.getVoices())
        const voices = speechSynthesis.getVoices().filter(voice => voice.voiceURI === 'Google US English');
        if (voices.length > 0) {
          utterance.voice = voices[0];
        }
        window.speechSynthesis.speak(utterance);
        setSpeaking(true);

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIndicates that issue is a question.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions