0

I'm attempting to read a zip file containing both M4A and WAV files. My goal is to extract and process these audio files, and then upload them as NPY files to a database.

I'm uncertain whether my current approach of reading the files directly from the zip archive is appropriate. Should I consider using the librosa library specifically for handling the WAV files?

   with zipfile.ZipFile(zip_path) as z:
        audio_files = [file_path for file_path in sorted(z.namelist()) if 
   file_path.endswith('.m4a') ]
   for audio_file_path in tqdm(audio_files):
         lines = []
         for line in z.read(audio_file_path):
                lines.append(line) 
Brad
  • 159,648
  • 54
  • 349
  • 530
slowmonk
  • 111
  • 2

1 Answers1

1

It sounds that you're rather doing batch processing than working on real-time audio streams.

In such case you're likely easier off by fist extracting the audio files from zip archive onto temp drive, then you'll have freedom to process your audio files on the temp drive using librosa or whatever appropriate audio toolkits, and finally store the outcome to your database.

Olli
  • 165
  • 1
  • 5