Mp3 to
WAV converter in python – 16/07/2025
I have made
a mp3 to wav converter in python. It uses the moviepy
pip library(pip install moviepy).
It has a
progress bar, and allows bulk processing. It also allows
the user to set an output folder.
See the
python code here:
import tkinter as tk from tkinter import filedialog, messagebox, ttk from moviepy.editor
import AudioFileClip import threading import os class MP3toWAVConverter(tk.Tk): def __init__(self): super().__init__() self.title("Bulk MP3 to WAV
Converter") self.geometry("450x220") self.configure(padx=20, pady=20) self.files = [] self.label = tk.Label(self, text="Select MP3 files to
convert:") self.label.pack(pady=(0,10)) self.select_button = tk.Button(self,
text="Select MP3 Files", command=self.select_files) self.select_button.pack(pady=(0,10)) self.convert_button = tk.Button(self,
text="Convert to WAV", command=self.start_conversion, state=tk.DISABLED) self.convert_button.pack(pady=(0,10)) self.progress = ttk.Progressbar(self,
orient='horizontal', length=350, mode='determinate') self.progress.pack(pady=(10,10)) self.status_label = tk.Label(self,
text="", fg="green") self.status_label.pack() def select_files(self): self.files = filedialog.askopenfilenames(
title="Select MP3 files", filetypes=[("MP3 Files", "*.mp3")]) if self.files: self.status_label.config(text=f"{len(self.files)}
files selected.") self.convert_button.config(state=tk.NORMAL) self.progress['value'] = 0 else: self.status_label.config(text="No files selected.") self.convert_button.config(state=tk.DISABLED) self.progress['value'] = 0 def start_conversion(self): output_folder = filedialog.askdirectory(title="Select
output folder") if not output_folder: messagebox.showwarning("No
folder selected", "Please select an output folder.") return self.convert_button.config(state=tk.DISABLED) self.select_button.config(state=tk.DISABLED) self.status_label.config(text="Starting conversion...") threading.Thread(target=self.convert_files, args=(output_folder,),
daemon=True).start() def convert_files(self,
output_folder): total_files = len(self.files) success_count = 0 error_files = [] for idx, file in enumerate(self.files, start=1): try: audio_clip = AudioFileClip(file)
filename = os.path.splitext(os.path.basename(file))[0] output_path = os.path.join(output_folder,
filename + ".wav") audio_clip.write_audiofile(output_path, logger=None) audio_clip.close() success_count += 1 except
Exception as e: error_files.append(file) # Update
progress bar progress_percent = (idx / total_files) * 100 self.progress.after(0, lambda: self.progress.config(value=progress_percent)) self.status_label.after(0,
lambda: self.status_label.config(text=f"Converting {idx} of {total_files} files...")) msg = f"Converted {success_count}
files successfully." if error_files: msg +=
f"\nFailed to convert {len(error_files)} files." self.status_label.after(0,
self.status_label.config,
{"text": "Conversion done."}) messagebox.showinfo("Conversion
Complete", msg) self.convert_button.config(state=tk.NORMAL) self.select_button.config(state=tk.NORMAL) if __name__ == "__main__": app = MP3toWAVConverter() app.mainloop() |