Monkihunta

New Member
Joined
Aug 29, 2014
Messages
1
Hi,

I have a big bunch of audio files, and I'd like to list them out in cell format with the lengths in seconds listed out next to them. I have a simple batch file that I found online that lists out filenames in wordpad. Is there something similar that would list out the file names with the lengths of the files in an east-to-separate format like "Filename(XX:XX:XX"

Thanks a lot!
 
Solution
To create a list of audio files along with their durations in a specific format, you can use a script in a programming language like Python. Below is a Python script that can help you achieve this. You'll need to have Python installed on your system to run the script. Here's a step-by-step guide to create the script and generate the list:

Step 1: Install Python​

If you don't have Python installed, download and install the latest version from the official Python website.

Step 2: Create and Run the Script​

Create a new Python script file with a .py extension, e.g., audio_file_duration.py. Copy and paste the following script into the file:
Python:
import os from mutagen.mp3 import MP3 from mutagen.wave import Wave # Function to...
To create a list of audio files along with their durations in a specific format, you can use a script in a programming language like Python. Below is a Python script that can help you achieve this. You'll need to have Python installed on your system to run the script. Here's a step-by-step guide to create the script and generate the list:

Step 1: Install Python​

If you don't have Python installed, download and install the latest version from the official Python website.

Step 2: Create and Run the Script​

Create a new Python script file with a .py extension, e.g., audio_file_duration.py. Copy and paste the following script into the file:
Python:
import os from mutagen.mp3 import MP3 from mutagen.wave import Wave # Function to get duration of audio files def get_audio_duration(file_path): if file_path.endswith('.mp3'): audio = MP3(file_path) return int(audio.info.length) elif file_path.endswith('.wav'): audio = Wave(file_path) return int(audio.info.length) else: return "N/A" # Directory containing audio files directory = "C:/Path/To/AudioFiles" # List audio files in the directory audio_files = [f for f in os.listdir(directory) if f.endswith(('.mp3', '.wav'))] # Output audio files with durations for audio_file in audio_files: duration = get_audio_duration(os.path.join(directory, audio_file)) print(f"{audio_file} ({duration} seconds)")

Step 3: Adjust the Script​

  • Replace "C:/Path/To/AudioFiles" with the path to your directory containing audio files.
  • The script currently supports MP3 and WAV files. You can modify the script to add support for other audio file types if needed.

Step 4: Run the Script​

Open a command prompt in the directory where you saved the script and run the script by typing python audio_file_duration.py and pressing Enter. The script will generate an output with the audio file names and their durations in seconds. You can then copy this output into a file or use it as needed. Hope this helps you create the list you need with audio file names and their durations formatted as desired.
 
Solution