播放音频与Python [英] Play audio with Python
问题描述
我怎么能播放的音频(它会像1秒声音)从Python脚本?
How can I play audio (it would be like a 1 second sound) from a Python script?
这将是最好的,如果它是独立的平台,但首先它需要在Mac上工作。
It would be best if it was platform independent, but firstly it needs to work on a Mac.
我知道我可以只从内部的Python执行 afplay file.mp3
命令,但有可能做到这一点原始的Python?我会更好,如果它不依赖于外部库。
I know I could just execute the afplay file.mp3
command from within Python, but is it possible to do it in raw Python? I would also be better if it didn't rely on external libraries.
推荐答案
您可以找到有关Python的音频信息在这里: HTTP:/ /wiki.python.org/moin/Audio/
You can find information about Python audio here: http://wiki.python.org/moin/Audio/
它看起来并不像它可以播放.mp3文件,无需外部库。你既可以你的.mp3文件转换为一个.wav或其他格式,或使用如 PyMedia 。
It doesn't look like it can play .mp3 files without external libraries. You could either convert your .mp3 file to a .wav or other format, or use a library like PyMedia.
这篇关于播放音频与Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!