You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a small proposal for the make_chunks function to make a bit more mem aware. What about changing it to a generator expression instead of a list compression. This saved me quite some mem when handling hours of audio data, if I just want to iterate over them to e.g. calculate the RMS.
def make_chunks(audio_segment, chunk_length):
"""
Breaks an AudioSegment into chunks that are <chunk_length> milliseconds
long.
if chunk_length is 50 then you'll get a list of 50 millisecond long audio
segments back (except the last one, which can be shorter)
"""
number_of_chunks = ceil(len(audio_segment) / float(chunk_length))
return (audio_segment[i * chunk_length:(i + 1) * chunk_length]
for i in range(int(number_of_chunks)))
The text was updated successfully, but these errors were encountered:
I have a small proposal for the make_chunks function to make a bit more mem aware. What about changing it to a generator expression instead of a list compression. This saved me quite some mem when handling hours of audio data, if I just want to iterate over them to e.g. calculate the RMS.
pydub/pydub/utils.py
Line 144 in 996cec4
The text was updated successfully, but these errors were encountered: