i,m writing a code using pydub
module to get data from an audio file , but i want to do the same actions using librosa
module , how to convert my code and get the same result with librosa
here's my code :
import numpy as np
from pydub import AudioSegment
audiofile = AudioSegment.from_file(filename)
data = np.fromstring(audiofile._data,np.int16)
channels = []
for c in range(audiofile.channels):
channels.append(data[c::audiofile.channels])
fs = audiofile.frame_rate
return channels, fs