I have audio clips of people being interviewed and am trying to split the audio clips using python such that all speech segments of the interviewee are outputted in one audio file (eg .wav format) & that of the interviewer in another audio file. Speaker recognition needs to be performed using unsupervised learning.

So far I have found a few libraries that perform the speaker diarization task (pyAudioAnalysis, aalto-speech) but none that combine the different speaker segments and output it in separate audio files. How do I segment the audio files & combine them based on the speaker?

  • $\begingroup$ I did by detecting silence and splitting on silence.. library used was pydub . What was your solution? $\endgroup$ Jan 17, 2020 at 13:25

2 Answers 2


Initially I did using silence detection but later moved to pyAudioAnalsis which is better.

Check "Speaker Diarization" section in Segmentation in pyAudioAnalysis


I assume you use wavfile.read from scipy.io to read an audio file.

My approach would be to make $N$ arrays (one for each speaker) that have the same size as the original audio array, but filled with zeroes (=silence). For each speaker detected by the diarization, assign all their segments to the corresponding segments in the speaker's array.

Finally, you can save each speaker's array in a separate file.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.