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

Add ability to adjust speed #420

Open
2 tasks done
KonerDev opened this issue Jun 24, 2023 · 4 comments
Open
2 tasks done

Add ability to adjust speed #420

KonerDev opened this issue Jun 24, 2023 · 4 comments

Comments

@KonerDev
Copy link

KonerDev commented Jun 24, 2023

Prerequisites

  • Did you make sure a similar issue didn't exist?
  • Did you update gTTS to the latest? (pip install --upgrade gTTS)

Proposed Behaviour

I suggest adding a feature that allows users to modify the speed of the tts output.

tts = gTTS(text='Hello World!', lang='en', speed=2.1)
tts.save(name)

Context

There is currently no way to make the speed particularly fast. Can you please add that?

@hanzigs
Copy link

hanzigs commented Aug 20, 2023

speed will be a nice feature,
Is there a way to give pause in the sentence?

@ILG2021
Copy link

ILG2021 commented Aug 29, 2023

still needs the feature.

@pndurette
Copy link
Owner

Google Translate only has two arbitrary speech speed options ("normal" and "slow"), to modify the speed, gTTS would need to tap into some sound libraries, which it currently leaves to the developer.

I don't think I'd want to add it in (unless I add some extra optional dependancies, perhaps), but I could eventually provide examples of how achieve it, TBD. Will put this documentation.

@ILG2021
Copy link

ILG2021 commented Sep 28, 2023

I have implement it by ffmpeg:

output_audio_file = "output_audio.mp3"
ffmpeg_command = ["ffmpeg", "-y", "-i", temp_audio_file, "-filter:a", "atempo=1.3", output_audio_file]
subprocess.run(ffmpeg_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

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

No branches or pull requests

4 participants