audio module
Torsten Marek
shlomme at gmx.net
Wed Sep 17 08:03:28 EDT 2003
Todd Stephens schrieb:
> Is there such a module containing audio tools? I am looking specifically
> for tools to manipulate ogg-vorbis and convert other formats (mp3, wav) to
> ogg.
>
What do you mean by "manipulation"? Edit the tag info? You can have a
try with (my) libtagedit (libtagedit.sourceforge.net), which supports
mp3 as well.
Converting mp3 into ogg with preserving the tag information consists
mostly out of building the commandline:
trans_table = {
"Artist": "--artist",
"Title": "--title",
"Track": "--tracknum",
"Genre": "--genre",
"Year": "--date",
"Album": "--album",
"Comment": "-c ="}
def mp3ToOgg(tag, outdir, quality="3,5"):
args = ["%s \"%s\"" % (trans_table[field], tag[field])
for field in trans_table.keys() if tag[field]]
args = " ".join(args)
new = os.path.join(outdir,
os.path.basename(tag.filename().replace(".mp3", ".ogg")))
os.system("lame --decode \"%s\" -|oggenc -q %s -r -o \"%s\" %s -" %
(tag.filename(), quality, new, args))
This example uses libtagedit (tag is a tageditor class). If you want
more specific information, I could mail you some scripts I wrote.
greets
Torsten
More information about the Python-list
mailing list