从存储在Python变量中的数据播放声音 [英] Playing a sound from data stored in a variable in Python

查看:235
本文介绍了从存储在Python变量中的数据播放声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Python 2.7,win 7、64位,并且我需要播放存储在变量中的声音数据.当然,可以制作并播放WAV文件,但是是否可以直接播放该文件?您能推荐图书馆等吗? 显然,听众现在已经过时了(如从存储在数组中的波形播放声音).

I am using Python 2.7, win 7, 64bit and I need to play a sound data stored in a variable. Of course, there is a possibility to make a WAV file and play it, but is there any option to play that directly? Could you recommend a library, etc. etc.? Apparently, audiere is outdated by now (as presented in Playing a sound from a wave form stored in an array).

推荐答案

您可能正在寻找的是pyAudio: http://people.csail.mit.edu/hubert/pyaudio/docs/

What you might be looking for is pyAudio : http://people.csail.mit.edu/hubert/pyaudio/docs/

在示例中查看他们如何将wav文件存储在变量中然后进行播放.

See in the example how they are storing a wav file in a variable and then playing it.

这篇关于从存储在Python变量中的数据播放声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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