%%capture
!pip install inaSpeechSegmenter
from inaSpeechSegmenter import Segmenter
%%capture
!wget https://podcast.rasset.ie/podcasts/audio/2021/0626/20210626_rteraidion-bailiuchanbhairbre-bailichnbh_c21974765_21975131_232_.mp3
seg = Segmenter()
segmentation = seg('20210626_rteraidion-bailiuchanbhairbre-bailichnbh_c21974765_21975131_232_.mp3')
/usr/local/lib/python3.7/dist-packages/pyannote/algorithms/utils/viterbi.py:88: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.
  for e, c in six.moves.zip(emission.T, consecutive)
/usr/local/lib/python3.7/dist-packages/pyannote/algorithms/utils/viterbi.py:97: FutureWarning: arrays to stack must be passed as a "sequence" type such as list or tuple. Support for non-sequence iterables such as generators is deprecated as of NumPy 1.16 and will raise an error in the future.
  for e, c in six.moves.zip(constraint.T, consecutive)
segmentation[0:6]
[('noEnergy', 0.0, 0.88),
 ('music', 0.88, 4.72),
 ('female', 4.72, 6.82),
 ('male', 6.82, 11.34),
 ('music', 11.34, 15.38),
 ('male', 15.38, 26.68)]
!pip install pydub
Collecting pydub
  Downloading pydub-0.25.1-py2.py3-none-any.whl (32 kB)
Installing collected packages: pydub
Successfully installed pydub-0.25.1
from pydub import AudioSegment
audio = AudioSegment.from_mp3('20210626_rteraidion-bailiuchanbhairbre-bailichnbh_c21974765_21975131_232_.mp3')
clip1 = audio[int(0.88 * 1000):int(4.72 * 1000)]
clip1.export("clip1.ogg", format="ogg")
<_io.BufferedRandom name='clip1.ogg'>
import IPython
IPython.display.Audio("clip1.ogg")
clip2 = audio[int(4.72 * 1000):int(11.34 * 1000)]
clip2.export("clip2.ogg", format="ogg")
IPython.display.Audio("clip2.ogg")
clip3 = audio[int(981.08 * 1000):int(992.74 * 1000)]
clip3.export("clip3.ogg", format="ogg")
IPython.display.Audio("clip3.ogg")