Advertisement
Tkap1

Untitled

Dec 12th, 2022
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. r = requests.get("https://api.streamelements.com/kappa/v2/speech?voice=%s&text=%s" % (voice_id, msg))
  2. if r.status_code == 200:
  3. frame_rate_index = utils.clamp(frame_rate_index, 0, len(g.rates) - 1)
  4. frame_rate = g.rates[frame_rate_index]
  5. sound = AudioSegment.from_file(io.BytesIO(r.content), format="mp3")
  6. sound = sound.set_frame_rate(44100)
  7. sound.frame_rate = frame_rate
  8. sound = utils.match_target_amplitude(sound, -15)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement