【问题标题】:reading .opus audio files in python在 python 中读取 .opus 音频文件
【发布时间】:2021-03-26 22:59:04
【问题描述】:

我正在尝试使用 librosa 读取 .opus 文件,但它会一直运行并且不会加载任何内容(我等了大约 30 分钟才得到一个 51MB 的文件,但仍然没有结果)。

这是我正在使用的代码

path_to_opus = '/my/path/to/file.opus'
y, sr = librosa.load(path_to_opus, sr=16000)

有没有快速读取python中.opus音频文件的好方法?

谢谢!

【问题讨论】:

    标签: python librosa opus


    【解决方案1】:

    通过查看 librosa 文档,您可以指定一个听起来对您有用的 res_type 字段。 这是引用from the doc

    res_type : str

    默认情况下,这使用 resampy 的高质量模式 ('kaiser_best')。

    要使用更快的方法,请设置 res_type='kaiser_fast'。

    要使用 scipy.signal.resample,请设置 res_type='scipy'。

    你可以试试这样的:

    X, sr = librosa.load('myfile.opus', res_type='kaiser_fast', ...)
    

    【讨论】:

      猜你喜欢
      • 2017-10-13
      • 2018-02-19
      • 2020-04-29
      • 2018-01-23
      • 2017-11-10
      • 2017-11-22
      • 2014-04-14
      • 1970-01-01
      • 2011-03-15
      相关资源
      最近更新 更多