I\'m aware of the following question: How to create a pydub AudioSegment using an numpy array?
My question is the right opposite. If I have a pydub AudioSegment how can
You can get an array.array from an AudioSegment then convert it to a numpy.ndarray:
array.array
AudioSegment
numpy.ndarray
from pydub import AudioSegment import numpy as np song = AudioSegment.from_mp3('song.mp3') samples = song.get_array_of_samples() samples = np.array(samples)