/audio_length

A small script to get the length of audio files based on a CSV from KoboToolbox by checking each file via the Kobo API

Primary LanguagePython

This script pulls all audio files for a specific question in a specific KoboToolbox project, checks the length of each file, and stores the result in a CSV file.

  1. Download or clone the Python file on your computer. Install dependencies from get_audio_length.py as needed.
  2. Download the data from the KoboToolbox project as a CSV in the same directory using XML/names. Only include the most important columns to make it easy to read, but it must include the audio question (with the URL checkbox ticked in export settings) since that will be used to pull the actual audio files. The uuid column is always included by default.
  3. Copy config-sample.json as config.json and set the following values:
  4. Set the API key for your account that contains the project
  5. Set the CSV file name
  6. Set the name of the audio file URL column (e.g. "experience_joint_decision_URL")
  7. Run the Python script with python get_audio_length.py or python3 get_audio_length.py, depending on your setup.
  8. It will iterate over all audio files, downloading them and writing the length to the output.csv file (as well as download status for each one). This may take a while depending on the number of files.