Hello I'm trying to get the raw bytestring out of pydub AudioSegment.
I've already tried following:
sound = AudioSegment.from_mp3(file="../source/myfile.mp3")
bytestring = sound.raw_data
and
sound = AudioSegment.from_mp3(file="../source/myfile.mp3")
bytestring = sound._data
but in my case it returns always a bytestring of with len 686866320 Bytes.
if I export it instead to a bytes array like following:
sound = AudioSegment.from_mp3(file="../source/myfile.mp3")
bytes = io.BytesIO()
bytes = sound.export(bytes, format='mp3')
I'm getting a much smaller len of 62301665.
At the end I'd like to have a bytestring and it's real size which (in my case is the real filesize of 62301665) but I cannot figure out how export reduces / compresses the data. The plain datastring of sound.raw_data
cannot be played either.
Thank you for any help :)