AttributeError:' str'对象没有属性' export'执行chunk.export时

时间:2017-04-04 12:50:45

标签: python-3.x audio split export

我有一个音频文件,我正在尝试拆分并导出它。但我面临以下错误。请让我知道如何去做它

 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'

0 个答案:

没有答案