Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different TTS models #27

Closed
teledoc2 opened this issue Apr 9, 2024 · 5 comments · Fixed by #36
Closed

Different TTS models #27

teledoc2 opened this issue Apr 9, 2024 · 5 comments · Fixed by #36

Comments

@teledoc2
Copy link

teledoc2 commented Apr 9, 2024

Great work, thank you for your contribution!

For cost purposes I tried using Neets.ai and Deepgram's TTS but cant get them to work. Terminal seems to log GPT-->TTS but not TTS --> Twilio despite following the docs and matching encoding. Any advice would be greatly appreciated.

Thanks again!

Abe

@cweems
Copy link
Collaborator

cweems commented Apr 10, 2024

@teledoc2 do you know what audio format you are outputting to the stream? Twilio only accepts ulaw_8000 since this is what is supported by the publicly switched telephone network. You can see where we set this with ElevenLabs: https://github.com/twilio-labs/call-gpt/blob/main/services/tts-service.js#L20

@teledoc2
Copy link
Author

thank you so much for the prompt response, yes both neets.ai and deepgram tts can produce output format ulaw_8000 (mulaw_8000 in neets.ai) and i added it as a param in the request, per docs, but still not able to pass the audio to twilio. When using base64 there is just a loud static and without base64 just silent and in both cases the terminal is showing no activity. Any advice would be appreciated. I just looked at openAI TTS and it seems to be a feasible solution so will try it next. Any other ideas would be greatly appreciated. Thanks so much! Abe

@daniel-makarov
Copy link

@teledoc2 Have you managed to successfully implement it with openAI TTS? I have tried but only hear static on my end. If you did, could you please share your solution?

@c0dr
Copy link

c0dr commented May 20, 2024

Neets was fairly easy to implement as they support output in mulaw, worked without any issues. To get openAI TTS to work you would probably need to use something like wavefile to convert it from wav to mulaw.

      const response = await fetch(
        'https://api.neets.ai/v1/tts',
        {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'X-API-Key': 'xxxxxx',
            accept: 'audio/wav',
          },
          body: JSON.stringify({
            text: partialResponse,
            voice_id: 'vits-eng-1',
            fmt: 'mulaw',
            params: {
              model: 'vits'
            }
          })
        }
      )

@SageWorks4925
Copy link

@c0dr Thanks! Your code works well for Neets ai API.

Do you know how we can add fillers like 'Umm', 'Sure' or 'Let me think'? I'm planning to add fillers to reduce the perception of latency between the 'human voice input' and the 'tts of gpt response'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants