# Audio2Spec **Repository Path**: mantis3d/Audio2Spec ## Basic Information - **Project Name**: Audio2Spec - **Description**: A Python-based desktop tool to batch convert audio files (WAV, MP3, FLAC, etc.) into Mel-spectrogram images with a 1:1 filename mapping. - **Primary Language**: Python - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-06-02 - **Last Updated**: 2026-06-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Audio to Spectrogram Batch Converter 🚀 A Python-based desktop tool to batch convert audio files (WAV, MP3, FLAC, etc.) into Mel-spectrogram images with a 1:1 filename mapping. It's perfect for dataset preprocessing in deep learning audio classification or acoustic analysis. --- ## ✨ Features * **📦 Batch Processing**: One-click folder scanning that supports `.wav`, `.mp3`, `.flac`, `.ogg`, and `.m4a` formats. * **🎨 Real-time Preview**: Instantly view the spectrogram effect on the right when switching between different color themes (like viridis, magma, gray, etc.) for easy comparison. * **⚙️ Highly Customizable**: * Supports custom image resolution (DPI) to meet needs ranging from quick previews to academic paper figures. * Auto-crops edges: generated images have **no coordinate axes and no white borders**, tailored purely for feature extraction. * **⚡ Thread Optimization**: Multi-threading ensures the UI never freezes when converting large batches of files, accompanied by real-time progress bar feedback. * **🖥️ Minimalist GUI**: Built on Tkinter, eliminating the need for complex command-line operations. --- ## 🛠️ Prerequisites Before running or developing, please make sure you have Python 3.x installed on your computer, along with the following dependency libraries: ```bash pip install librosa matplotlib numpy Pillow ``` --- ## 🚀 Quick Start ### 1. Prepare Preview Assets (Must-read for first-time use) To enable the UI to display color theme previews, you need to generate a set of assets first: * Place a short audio file named `sample.wav` in the project root directory. * Run the asset generation script, or ensure there is a `previews` folder in the root directory containing pictures for different themes like `preview_viridis.png`. ### 2. Start the Program Run the main script in your terminal: ```bash python audioToSpectrogram.py ``` ### 3. Set Paths * Click the **Browse** button to the right of "Audio Directory" to select the folder containing your audio files. * Click the **Browse** button to the right of "Image Save Directory" to select the folder where you want to save the spectrograms. ### 4. Adjust Parameters & Preview * Modify the image resolution (DPI) in the "Parameters" section. * Toggle the "Color Theme" dropdown menu to **preview** the visual effects of different themes in real time on the right. ### 5. Start Conversion Click the **Start Batch Conversion** button at the bottom. The progress bar will show the real-time progress. A prompt box will pop up upon completion. --- ## 📄 License This project is licensed under the [MIT License](LICENSE). You are free to use, modify, and distribute this code.