pyAudioAnalysis icon indicating copy to clipboard operation
pyAudioAnalysis copied to clipboard

Split Audio

Open engmohamedsalah opened this issue 5 years ago • 2 comments

How I can use this library to split audio into chunks for example, I have an audio file with a size of 100 seconds I need to cut that into small files from as following a file contains the audio from second 0 to second 5 a file contains the audio from second 23 to second 40 a file contains the audio from second 80 to second 90

I use the following code but I got an error message

`from pyAudioAnalysis import audioTrainTest as aT from pyAudioAnalysis import audioBasicIO from pyAudioAnalysis import ShortTermFeatures from pyAudioAnalysis import audioSegmentation as aS

[Fs, x] = audioBasicIO.read_audio_file("C:/Test/HelloDialog.wav") F, f_names = ShortTermFeatures.feature_extraction(x, Fs, 0.005Fs, 0.9Fs)`

is this correct ?

engmohamedsalah avatar Nov 26 '20 18:11 engmohamedsalah

maybe better to use sox command line tool for such tasks

tyctor avatar Jan 28 '21 14:01 tyctor

Indeed u can use sox, or ffmpeg command line (check may article here for some examples https://medium.com/behavioral-signals-ai/basic-audio-handling-d4cc9c70d64d)

also there are plenty of examples in this library that show how u can do this programmatically using wavwrite (e.g. check the silence removal function wrapper that also saves the non-silence segments to wav files).

tyiannak avatar Jan 29 '21 22:01 tyiannak