gpt4 book ai didi

Python 将 CD 文件翻录为 WAV

转载 作者:太空宇宙 更新时间:2023-11-04 03:32:35 26 4
gpt4 key购买 nike

我正在编写一个程序,我需要能够将 CD 中的文件翻录成 WAV 格式(或 flac,但 wav 可以正常工作)。它必须在 Windows 上运行。我看到其他答案推荐将 Express Rip 和 Audio Commander 作为命令行工具。但是 Audio Commander 的页面似乎已经不存在了。而且我不太确定 express rip,它似乎有点粗略。

然后他们提到了用于检索元数据的诱变剂。

有人对这些实用程序或这个目标有任何经验吗?我希望能够以 WAV 格式翻录 CD,保留那里的元数据,如果可能的话,还可以检查 CD Archive 中的元数据。

有没有人做过这样的事情,或者对模块、实用程序、方法等有建议,让我继续前进?即使是一些小例子也会有所帮助。这是用 python 或模块来完成任务的翻录 cd 的示例。

最佳答案

您可能想看看 PyMedia

PyMedia is a Python module for wav, mp3, ogg, avi, divx, dvd, cdda etc files manipulations. It allows you to parse, demutiplex, multiplex, decode and encode all supported formats. It can be compiled for Windows, Linux and cygwin.

PyMedia was built to be really simple and flexible at the same time. See tutorial for example. It allows you to create your own multimedia applications in a matter of minutes and adjust it to your needs using other components. Python language is chosen because of simple semantics, complete and reach set of features.

您也可以将其用作库:

来自他们的 Audio CD Grabber :

import pymedia.removable.cd as cd

def readTrack(track, offset, bytes):
cd.init()
if cd.getCount() == 0:
print 'There is no cdrom found. Bailing out...'
return 0

c = cd.CD(0)
props = c.getProperties()
if props['type'] != 'AudioCD':
print 'Media in %s has type %s, not AudioCD. Cannot read audio data.' % (c.getName(), props['type'])
return 0

tr0 = c.open(props['titles'][track - 1]['name'])
tr0.seek(offset, cd.SEEK_SET)
return tr0.read(bytes)

更新:要访问有关音频 CD 的元数据,您可以使用 PyCDDB图书馆。

关于Python 将 CD 文件翻录为 WAV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30472518/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com