<jupyter_start><jupyter_text>Get the lecture audio and break it into smaller parts<jupyter_code>#pip install pydub
import moviepy.editor
video = moviepy.editor.VideoFileClip('zoom_0.mp4')
audio = video.audio
audio.write_audiofile('lecture_audio.wav')
from pydub import AudioSegment
from pydub.utils import make_chunks
import os

myaudio = AudioSegment.from_file("lecture_audio.wav" , "wav") 
chunk_length_ms = 4000 # pydub calculates in millisec
chunks = make_chunks(myaudio, chunk_length_ms) #Make chunks of 4 sec

#Export all of the individual chunks as wav files
path = "lecture_chunks/"
try:
    os.mkdir(path)
except OSError:
    print ("Creation of the directory %s failed" % path)
else:
    print ("Successfully created the directory %s " % path)

for i, chunk in enumerate(chunks):
    chunk_name = "lecture_chunks/chunk{0}.wav".format(i)
    print ("exporting", chunk_name)
    chunk.export(chunk_name, format="wav")<jupyter_output>Successfully created the directory lecture_chunks/ 
exporting lecture_chunks/chunk0.wav
exporting lecture_chunks/chunk1.wav
exporting lecture_chunks/chunk2.wav
exporting lecture_chunks/chunk3.wav
exporting lecture_chunks/chunk4.wav
exporting lecture_chunks/chunk5.wav
exporting lecture_chunks/chunk6.wav
exporting lecture_chunks/chunk7.wav
exporting lecture_chunks/chunk8.wav
exporting lecture_chunks/chunk9.wav
exporting lecture_chunks/chunk10.wav
exporting lecture_chunks/chunk11.wav
exporting lecture_chunks/chunk12.wav
exporting lecture_chunks/chunk13.wav
exporting lecture_chunks/chunk14.wav
exporting lecture_chunks/chunk15.wav
exporting lecture_chunks/chunk16.wav
exporting lecture_chunks/chunk17.wav
exporting lecture_chunks/chunk18.wav
exporting lecture_chunks/chunk19.wav
exporting lecture_chunks/chunk20.wav
exporting lecture_chunks/chunk21.wav
exporting lecture_chunks/chunk22.wav
exporting lecture_chunks/chunk23.wav
exporting lecture_chunks/chunk24.wav
exporting lecture_chunks/chunk25.[...]
{'fraction_non_alphanumeric': 0.0775950668036999, 'fraction_numerical': 0.025693730729701953, 'mean_word_length': 6.546511627906977, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '83968', 'license': 'MIT', 'n_tokens_mistral': 695, 'n_tokens_neox': 667, 'n_words': 145, 'path': 'audio_analysis/Notebooks/Break_AudioSample.ipynb', 'repo_name': 'tatianaportsova/TeamReel_DS', 'size': '1946'}