AttributeError: module 'librosa' has no attribute 'output'

Viewed 27753

I am using librosa 0.6 in anaconda and i have also installed ffmpeg but i am still getting this error

the code is

a = np.exp(spectrum) - 1
    p = 2 * np.pi * np.random.random_sample(spectrum.shape) - np.pi
    for i in range(50):
        S = a * np.exp(1j * p)
        x = librosa.istft(S)
        p = np.angle(librosa.stft(x, N_FFT))
    librosa.output.write_wav(outfile, x, sr)

2 Answers

librosa.output was removed in librosa version 0.8.0. This is documented in their changelog. So the most likely reason for your issue is that you are using this new version of librosa (and not version 0.6.x). You can verify by doing print(librosa.__version__).

With moden librosa, you should instead use soundfile.write to write audio output.

Related