欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

flac 和 wav音频格式转换

程序员文章站 2022-05-28 15:17:28
...

参考:https://*.com/questions/23925494/how-to-convert-wav-to-flac-from-python

wav to flac:

import audiotools
filepath_wav = 'music.wav'
filepath_flac = filepath_wav.replace(".wav", ".flac")
audiotools.open(filepath_wav).convert(filepath_flac,
                                      audiotools.FlacAudio)

flac to wav:

import audiotools
filepath_flac = 'music.flac'
filepath_wav = filepath_flac.replace(".flac", ".wav")
audiotools.open(filepath_flac).convert(filepath_wav,
                                      audiotools.WaveAudio)