I have loaded and performed modifications to an audio clip using AudioSegment.from_mp3
. I need to perform analysis on the clip and so I am attempting to load the file using librosa.load()
. I know I could save the audio and then load it but it seems very inefficient. Every answer to this problem I can find is very messy.
I can get the raw data of the audio clip by using audio_clip.raw_data
however this is in bytes and load
only accepts str | int | PathLike | SoundFile | AudioFile | BinaryIO
. I don't know much about BinaryIO but is it possible to convert bytes (or BytesIO
) to BinaryIO
?
Here is the relevant code:
audio_clip = AudioSegment.from_mp3("example.mp3")
# ... perform modification
y, sr = librosa.load(somehow convert audio clip to a loadable format)