Skip to content
Advertisement

How can i split an Audio file into multiple audio wav files from folder

I have a folder where i have about 2000 audio files in wav format with different time intervals, say some are in 30 sec some 40 and i want to split all of them using python, i tried pydub and different libraries and all of them working for 1 file only, i want to split those using a loop with simple code in python.

Sample code:

JavaScript

The above code is working for one file whereas i need it to take files from folder and split all of them

Advertisement

Answer

You have to get all the file names in your directory and then iterate for all file names.

You can use os module to get list of all the files in the current directory.

JavaScript
User contributions licensed under: CC BY-SA
11 People found this is helpful
Advertisement