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

Aditya Kumar picture Aditya Kumar · Sep 21, 2020 · Viewed 9.3k times · Source

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)

Answer

ANAS.C picture ANAS.C · Nov 6, 2020

you can use this instead

import soundfile as sf
sf.write('stereo_file1.wav', reduced_noise, 48000, 'PCM_24')

check more here https://pysoundfile.readthedocs.io/en/0.8.1/#soundfile.write