File size: 544 Bytes
a841aa5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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)