A Python application for converting audio files to MIDI format, specifically designed for use with the Synthstrom Deluge synthesizer. This tool processes audio files and generates XML files that are compatible with the Deluge's song format.
- Convert audio files to MIDI format using basic-pitch
- Convert MIDI files to XML format optimized for Synthstrom Deluge compatibility
- Supports various audio input formats
- Generates Deluge-compatible XML configurations
The program offers two main conversion paths:
-
Full Audio to XML Conversion
- Converts audio files from
data/audio_input
to MIDI format - Automatically processes the generated MIDI files to Deluge-compatible XML
- Uses basic-pitch for accurate audio-to-MIDI conversion
- Final XML files can be directly loaded into your Deluge
- Converts audio files from
-
MIDI to XML Conversion
- Converts existing MIDI files from
data/input_midi
to Deluge XML format - Useful if you already have MIDI files and just need the Deluge format
- Preserves MIDI note data and converts it to Deluge's song structure
- Converts existing MIDI files from
Note:
- Basic-pitch produces a single track for all notes. It's best to feed a custom built midi file if possible in lieu of it's outputs.
- Well structured midi files will translate over to the Deluge song xml file.
- At the moment the instruments assigned to each track are randomized from this list: PRESET_NAMES = [ "000 Rich Saw Bass", "001 Sync Bass", "002 Basic Square Bass", "003 Synthwave Bass", "005 Sweet Mono Bass", "006 Vaporwave Bass", "007 Detuned Saw Bass", "009 Hoover Bass", "019 Fizzy Strings", "026 Pw Organ", "030 Distant Porta", "040 Spacer Leader", "073 Piano", "074 Electric Piano", "076 Organ", "078 House", ]
- The program utilizes a base.xml file found in src/resources. This way we avoid over-complicating the implementation and it simply injects the new tracks with randomly assigned presets to the base.xml file.
- Python >=3.6
- FFmpeg (must be placed in the
bin/
folder)- Required files:
bin/ffmpeg.exe
bin/ffprobe.exe
- You can download FFmpeg from FFmpeg's official website
- Required files:
DelugeMidiConverter/
├── src/
│ └── deluge_midi_converter/
│ ├── __init__.py
│ ├── core/
│ │ ├── __init__.py
│ │ ├── midi_converter.py
│ │ ├── basic_pitch_processor.py
│ │ └── xml_injector.py
│ └── main.py
├── data/
│ ├── audio_input/ # Place input audio files here
│ ├── input_midi/ # Place input MIDI files here
│ ├── midi_output/ # Generated MIDI files will appear here
│ └── deluge_songs/ # Final Deluge XML song files
├── bin/
│ ├── ffmpeg.exe # Required FFmpeg executable
│ └── ffprobe.exe # Required FFprobe executable
├── logs/
│ └── app.log # Application logs
└── requirements.txt # Python dependencies
- Clone the repository:
git clone [https://github.com/IvanVeridian/deluge-tune-crafter.git]
cd DelugeMidiConverter
- Create a virtual environment:
python -m venv .venv
- Activate the virtual environment:
- Windows:
.venv\Scripts\activate
- Unix/MacOS:
source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
Note about Basic Pitch Installation: By default, this project uses the platform-specific version of Basic Pitch (ONNX for Windows, CoreML for MacOS, TensorFlowLite for Linux) for wider compatibility. While this works well, the TensorFlow version may provide better performance.
To use the TensorFlow version instead:
- Option 1: Modify
requirements.txt
to includebasic-pitch[tf]
instead ofbasic-pitch
- Option 2: Manually install it after the other dependencies:
pip install basic-pitch[tf]
Note that TensorFlow is automatically included if you're using Python>=3.11.
- Download and install FFmpeg:
- Download FFmpeg from FFmpeg's official website
- Extract
ffmpeg.exe
andffprobe.exe
- Place both files in the
bin/
folder of the project
-
Choose your conversion path:
- For audio to XML: Place your audio files in
data/audio_input
- For MIDI to XML: Place your MIDI files in
data/input_midi
- For audio to XML: Place your audio files in
-
Ensure FFmpeg executables are in the
bin/
directory -
Run the converter:
python src/deluge_midi_converter/main.py
-
Select your desired conversion option from the menu:
- Option 1: Full process (Audio → MIDI → XML)
- Option 2: MIDI to XML only
- Option 3: Exit
-
Find your converted files:
- MIDI files in
data/midi_output
- Final XML files in
data/deluge_songs
- Check
logs/app.log
for conversion details
- MIDI files in
- If you get FFmpeg-related errors, ensure both
ffmpeg.exe
andffprobe.exe
are correctly placed in thebin/
directory - Make sure your virtual environment is activated before running the converter
- Check the
logs/app.log
file for detailed error messages and debugging information
See requirements.txt
for a complete list of Python package dependencies.
This project wouldn't have been possible without the following contributions:
-
Downrush by Jamie Faye - The original midian code provided invaluable insights into the Deluge XML structure conversion, which inspired this Python-based implementation.
-
Basic Pitch by Spotify - A powerful and accurate audio-to-MIDI conversion engine that forms the backbone of our audio processing capabilities.
This project is licensed under a modified MIT License:
- ✅ Free to use, modify, and distribute for personal and non-commercial purposes
- ✅ Free to fork and contribute to the project
- ✅ Must include the original license and copyright notice
- ❌ Commercial use requires explicit written permission from the author
- ❌ No liability or warranty provided
For commercial use inquiries, please contact the author.
We welcome contributions! Here's how you can help:
-
Fork the Repository
- Create your own fork of the code
- Clone your fork locally
-
Create a Branch
- Create a new branch for your feature/fix
- Use a clear naming convention (e.g.,
feature/new-feature
orfix/bug-description
)
-
Code Standards
- Follow PEP 8 style guide for Python code
- Add comments for complex logic
- Update documentation as needed
- Include type hints where applicable
-
Testing
- Add tests for new features
- Ensure all existing tests pass
- Test with different audio formats if adding format support
-
Commit Guidelines
- Use clear, descriptive commit messages
- Reference issues in commits where applicable
- Keep commits focused and atomic
-
Submit a Pull Request
- Provide a clear description of the changes
- Link any related issues
- Ensure CI checks pass
- Be responsive to review comments
-
Code Review
- All contributions require review
- Address review feedback promptly
- Be open to suggestions and improvements
For major changes, please open an issue first to discuss what you would like to change.