I am doing masters thesis on audio detection using machine learning.I have some long audio files.I want to split this audio file into multiple short length audio file using python.Ex:The audio long length is more than 1 hour and want to split into multiple short length 5s files. i want to extract features for the whole audio file in each 5s or so on. or please guide that i can split the long audio file into multiple smaller pieces and all the smaller value has almost same value.
Thank's in advance
I am doing masters thesis on audio detection using machine learning.I have some long audio files.I want to split this audio file into multiple short length audio file using python.Ex:The audio long length is more than 1 hour and want to split into multiple short length 5s files. i want to extract features for the whole audio file in each 5s or so on. or please guide that i can split the long audio file into multiple smaller pieces and all the smaller value has almost same value.
Thank's in advance
--
You received this message because you are subscribed to the Google Groups "librosa" group.
To unsubscribe from this group and stop receiving emails from it, send an email to librosa+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/librosa/4b1709c9-14f4-4369-bb2f-a94bf8f97c57n%40googlegroups.com.
import librosa
import soundfile as sf
file = "your_source_file.wav"
x, sr = librosa.load(file, sr=None)
you will get x as audio file in numpy array and sr as original sampling rate
for i in range(0, len(x),5 * sr)
y = x[5 * sr * i: 5 * sr *(i+1)]
sf.write("dest_audio"+str(i)+".wav", y, sr)