Skip to content

Text to Speech: Get timing for each word together with the audio response #17

In review

Description

@namnm

Hi. Is it possible to get timing for each word together with the audio response?

Activity

  1. abersheeran commented on Mar 1, 2025

    @abersheeran
    Member

    Your mean, want to get caption?

  2. namnm commented on Mar 1, 2025

    @namnm
    Author

    @abersheeran For example: I have a text "Hello, how are you today?" then I get the audio from api with 5s long. The response should also include the timestamp info when each word was spoken aside with that audio buffer:

    {
      "text": "hello",
      "start_time": 0.5,
      "end_time": 1
    }

    With the above example, the word hello was spoken beginning at 0.5s and ending at 1s (0.5 spoken duration for that word).
    Then similar with the rest words, the result can come with an array.

    MORE REFERENCE:
    ElevenLabs: https://elevenlabs.io/docs/api-reference/text-to-speech/convert-with-timestamps
    Google Speech to Text: https://stackoverflow.com/a/64151885/9214970

  3. changed the title [-]Text to Speech: Get timing for each word in the transcript result[/-] [+]Speech to Text: Get timing for each word in the transcript result[/+] on Mar 1, 2025
  4. changed the title [-]Speech to Text: Get timing for each word in the transcript result[/-] [+]Text to Speech: Get timing for each word in the transcript result[/+] on Mar 1, 2025
  5. changed the title [-]Text to Speech: Get timing for each word in the transcript result[/-] [+]Text to Speech: Get timing for each word together with the audio response[/+] on Mar 1, 2025
  6. babangida4321 commented on Apr 3, 2025

    @babangida4321
  7. jcmelati commented on Jun 26, 2025

    @jcmelati

    Any development here? I really need this feature.

  8. abersheeran commented on Jun 27, 2025

    @abersheeran
    Member

    We are in development, but there is no confirmed launch date for now.

  9. Mhdiwe commented on Aug 3, 2025

    @Mhdiwe

    Try this: https://theaivoicegenerator.com/timestamped-script-to-voice-generator/
    its using fish.audio too

    @abersheeran For example: I have a text "Hello, how are you today?" then I get the audio from api with 5s long. The response should also include the timestamp info when each word was spoken aside with that audio buffer:

    {
    "text": "hello",
    "start_time": 0.5,
    "end_time": 1
    }
    With the above example, the word hello was spoken beginning at 0.5s and ending at 1s (0.5 spoken duration for that word). Then similar with the rest words, the result can come with an array.

    MORE REFERENCE: ElevenLabs: https://elevenlabs.io/docs/api-reference/text-to-speech/convert-with-timestamps Google Speech to Text: https://stackoverflow.com/a/64151885/9214970

  10. sashenmethoddata commented on Aug 14, 2025

    @sashenmethoddata

    @abersheeran Want to know if there's a work around for this in the interim.

    I've tried the below:

    Using TTS to convert the text to speech
    Then STT the audio return above (response = self.fish_audio_session.asr(ASRRequest(audio=audio_data, ignore_timestamps=False)))

    This dose give start and end times for sentences, but when mapping trying to map the times back to the original text its always a miss.

  11. Mhdiwe commented on Jan 19, 2026

    @Mhdiwe
  12. lumpinif commented on Nov 24, 2026

    @lumpinif
    Contributor

    Update: the API now supports this. POST /v1/tts/stream/with-timestamp streams audio together with word-level timings. Docs: https://docs.fish.audio/api-reference/endpoint/openapi-v1/text-to-speech-stream-with-timestamps

    SDK support is in #173:

    result = client.tts.convert_with_timestamps(text="Hello! Welcome to Fish Audio.")
    for segment in result.segments:
        print(f"{segment.start:.2f}s - {segment.end:.2f}s  {segment.text}")

    There is also a streaming variant, client.tts.stream_with_timestamps. This issue will close when #173 is merged. Until then you can call the endpoint directly as shown in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions