|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我在试图用python播放文本,因为不想用保存文件再播放这种方法所以用了tempfile去创建一个文件然后pygame来播放,问题是在idle上运行没有问题可在pycharm里出现了一段话
Python[11034:2336797] 18:29:02.535 WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.系统是OS X El Capitan10.11.6,idle版本python3.6,pycharm版本2018.2.4- from gtts import gTTS
- from io import BytesIO
- import pygame
- mp3_fp=BytesIO()
- tts=gTTS('hello', 'en')
- tts.write_to_fp(mp3_fp)
- pygame.mixer.init()
- mp3_fp.seek(0)
- track=pygame.mixer.music.load(mp3_fp)
- pygame.mixer.music.play()
复制代码
|
|