You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Text to Speech: Get timing for each word together with the audio response #17
@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:
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.
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
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
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
@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.
@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.
result=client.tts.convert_with_timestamps(text="Hello! Welcome to Fish Audio.")
forsegmentinresult.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.
Activity
abersheeran commentedon Mar 1, 2025
Your mean, want to get caption?
namnm commentedon Mar 1, 2025
@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
[-]Text to Speech: Get timing for each word in the transcript result[/-][+]Speech to Text: Get timing for each word in the transcript result[/+][-]Speech to Text: Get timing for each word in the transcript result[/-][+]Text to Speech: Get timing for each word in the transcript result[/+][-]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[/+]babangida4321 commentedon Apr 3, 2025
#17
jcmelati commentedon Jun 26, 2025
Any development here? I really need this feature.
abersheeran commentedon Jun 27, 2025
We are in development, but there is no confirmed launch date for now.
Mhdiwe commentedon Aug 3, 2025
Try this: https://theaivoicegenerator.com/timestamped-script-to-voice-generator/
its using fish.audio too
sashenmethoddata commentedon Aug 14, 2025
@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.
Mhdiwe commentedon Jan 19, 2026
lumpinif commentedon Nov 24, 2026
Update: the API now supports this.
POST /v1/tts/stream/with-timestampstreams audio together with word-level timings. Docs: https://docs.fish.audio/api-reference/endpoint/openapi-v1/text-to-speech-stream-with-timestampsSDK support is in #173:
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.