从存储在Python变量中的数据播放声音 [英] Playing a sound from data stored in a variable in 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屋!