我有一个音频文件,我正在尝试拆分并导出它。但我面临以下错误。请让我知道如何去做它
from os import path
AUDIO_FILE = path.join(path.dirname(path.realpath('C:\\Users\\anagha\\Documents\\Python Scripts')),"Python Scripts\\audioa.aac")
chunks = split_on_silence(AUDIO_FILE,min_silence_len=500,silence_thresh=-16)
for i, chunk in enumerate(chunks):
out_file = "C:\\Users\\anagha\\Documents\\Python Scripts\\res.aac".format(i)
print("exporting", out_file)
chunk.export(out_file, format="aac")
或
for i, chunk in enumerate(chunks):
chunk.export("/path/to/ouput/dir/chunk{0}.wav".format(i), format="wav")
错误:
chunk.export(out_file, format="aac")
Traceback (most recent call last):
File "<ipython-input-90-474a71cb8d64>", line 1, in <module>
chunk.export(out_file, format="aac")
AttributeError: 'str' object has no attribute 'export'