[Python] Twilio TTS Mispronounces "Aradhya" – How to Fix It?

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    I’m using Twilio's text-to-speech (TTS) in a Django view to read out a message before connecting a call. However, Twilio mispronounces the name "Aradhya", and I’m looking for a way to fix it.

    Problem:


    Twilio reads "Aradhya" incorrectly, and I want it to sound like "Uh-raa-dhyaa" (अाराध्य in Hindi).

    Code (Simplified Version):


    from django.http import HttpResponse
    from django.views.decorators.csrf import csrf_exempt
    from twilio.twiml.voice_response import VoiceResponse

    @csrf_exempt
    def connect_call(request):
    response = VoiceResponse()
    customer_name = "John Doe" # Example; this is fetched dynamically in actual code
    response.say(f"Hello {customer_name}, I am Aradhya. Please hold while we connect you.")
    response.dial("+919836731154") # Connect call

    return HttpResponse(str(response), content_type="application/xml")

    What I Tried:

    1. Changing the spelling (e.g., "Aaraadhyaa", "Aradyaa") → No improvement.
    2. Using SSML <phoneme> tag:
      <Response>
      <Say>
      I am <phoneme alphabet="ipa" ph="əˈrɑːðjə">Aradhya</phoneme>.
      </Say>
      </Response>

      Issue: Twilio still mispronounces it.
    3. Adding pauses with <break>:
      <Say>Hello, I am <break time="200ms"/> Aaraadhyaa.</Say>

      Issue: Slight improvement, but not perfect.
    4. Using Twilio Neural Voices (Amazon Polly):
      <Response>
      <Say voice="Polly.Aditi">Hello, I am Aradhya.</Say>
      </Response>

      Issue: Not all Twilio accounts support Polly voices.
    Question:


    How can I get Twilio TTS to pronounce "Aradhya" correctly without using pre-recorded audio?

    Any help would be appreciated!

    Continue reading...

Compartilhe esta Página