我怎么能在Python转换文本到语音(MP3文件)? [英] How can I convert text to speech (mp3 file) in python?

查看:2366
本文介绍了我怎么能在Python转换文本到语音(MP3文件)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用puttsx文字转换为语音的蟒蛇。我可以用麦克风(耳机),将MP3文件做录制音频。

I can convert text to speech in python using puttsx. and I can do record audio using microphone(headphone) to mp3 file.

我想要做的就是将文本转换为MP3文件。结果
有没有使用pyttsx内存或单向code字符串存储音频播放的方式。

What I want to do is to convert text to mp3 file.
Is there a way to store audio playing using pyttsx to memory or unicode string.

谁能帮我存储音频内存,或者我怎么能这个字符串转换成MP3文件。

Can anyone help me storing audio to memory, or how I can convert that string to mp3 file.

推荐答案

我不知道pyttsx,但前一阵子我用谷歌TTS API生成从文本中的MP3。

I do not know about pyttsx, but a while ago I used the Google TTS API to generate MP3s from text.

您可以得到它从这个code段的想法。谷歌TTS的免费版本仅限于一定数量的字母为每个请求,所以我建议拆分文成句子和创建每个句子的文件。

You can get an idea of how it works from this code snippet. The free version of Google TTS is limited to a certain number of letters for each request, So I'd recommend splitting the text into sentences and creating a file for each sentence.

如果您需要,帮助,请告诉我。

If you need help with that, please tell me.

这篇关于我怎么能在Python转换文本到语音(MP3文件)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆