tonic
initial commit
a841aa5
raw
history blame contribute delete
544 Bytes
from pydub import AudioSegment
def split_wav(file_name, number_of_parts):
# Load the file
audio = AudioSegment.from_wav(file_name)
# Calculate the length of each part
length = len(audio) // number_of_parts
# Split the file and save each part
for i in range(number_of_parts):
start = length * i
end = start + length if i < number_of_parts - 1 else len(audio)
part = audio[start:end]
part.export(f"part_{i+1}.wav", format="wav")
# Split the file into 8 parts
split_wav("craig.wav", 10)