script_resample.py 721 B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. """script_download_mp3.ipynb
  3. Automatically generated by Colaboratory.
  4. Original file is located at
  5. https://colab.research.google.com/drive/12QC9ULnH-_nhwNOO9phzGEt57rSVysM0
  6. """
  7. # script to download the audio files:
  8. import os
  9. import re
  10. import urllib.request
  11. from pydub import AudioSegment as am
  12. child_list = ['Joe','The']
  13. for child in child_list:
  14. files = os.listdir(f'soderstrom/recordings/raw/{child}/')
  15. for file in files:
  16. if file.endswith('.mp3'):
  17. sound = am.from_file(f'soderstrom/recordings/raw/{child}/{file}', format='mp3', frame_rate=22050)
  18. sound = sound.set_frame_rate(16000)
  19. sound.export(f'recordings/raw/{child}/{file}', format='mp3')