export mp3 in python using ffmpeg
from subprocess import call
import shutil
def export_as_mp3(export_path, y, sr, bitrate='192k'):
tmp_input_path = "/tmp/___mp3___.wav"
tmp_output_path = "/tmp/___mp3___.mp3"
librosa.output.write_wav(tmp_input_path, y, sr)
call(["ffmpeg", "-i", tmp_input_path, "-b:a", str(bitrate), tmp_output_path])
shutil.move(tmp_output_path, export_path)