5.8 KiB
midicheck.py
midicheck.py scans all MIDI files in a specified directory and generates a text file for each MIDI file, providing an overview of pertinent data.
Features
- Batch Processing: Scans all MIDI files within a given directory.
- Detailed Output: Generates a separate text file for each MIDI file, summarizing key information.
Usage
python midicheck.py c:\path\to\midis
Example
To scan MIDI files located in C:\Users\YourName\Documents\MIDIs, run:
python midicheck.py C:\Users\YourName\Documents\MIDIs
redundancy_check.py
redundancy_check.py scans a MIDI file for any redundant data, such as repeating pitch data or unnecessary program changes. If any redundant data is found, it will be removed.
Features
- Redundancy Detection: Identifies unnecessary repeating pitch data and program changes.
- Automated Cleanup: Removes any detected redundant information.
- Output File: Creates a cleaned MIDI file with the suffix
_redundancy_check.mid.
Usage
python redundancy_check.py midiname.mid
Example
To check and clean song.mid, run:
python redundancy_check.py song.mid
This command will generate a file named song_redundancy_check.mid.
⚠️ Important: Always test the output MIDI file before deleting the original to ensure no unintended changes were made.
velfix.py
velfix.py modifies the velocity of every note in a MIDI file to a specified value, with the option to ignore certain MIDI channels.
Features
- Uniform Velocity Adjustment: Sets all note velocities to a user-defined value.
- Channel Exclusion: Allows specifying channels to exclude from velocity changes.
- Output File: Creates a modified MIDI file with the suffix
_velfix.mid.
Usage
python velfix.py midiname.mid new_velocity [channels_to_ignore]
midiname.mid: The MIDI file to be processed.new_velocity: The velocity value to set for all notes (0-127).channels_to_ignore(optional): Comma-separated list of MIDI channels to exclude from changes.
Example
To set all note velocities to 127 except for notes on channel 2 in matlock.mid, run:
python velfix.py matlock.mid 127 2
This command will generate a file named matlock_velfix.mid, where all velocities are set to 127 except for those on channel 2.
⚠️ Important: Always test the output MIDI file before deleting the original to ensure the changes meet your expectations.
monofy.py
monofy.py splits polyphonic tracks into multiple monophonic tracks while maintaining the same channel assignments. This tool is useful for splitting chords across multiple outputs.
Features
- Polyphonic to Monophonic Conversion: Separates multiple notes on a single channel into individual monophonic tracks.
- Channel Preservation: Maintains the original channel assignments for each new track.
- Output File: Creates a modified MIDI file with the suffix
_monofied.mid.
Usage
python monofy.py midifile.mid
Example
To split the polyphonic tracks in midifile.mid, run:
python monofy.py midifile.mid
This command will generate a file named midifile_monofied.mid.
⚠️ Important: Always test the output MIDI file before deleting the original to ensure the changes meet your expectations.
baketempo.py
baketempo.py is designed to process MIDI files by eliminating all tempo changes and embedding the playback speed directly into the absolute timing of MIDI events. This ensures that the resulting MIDI file maintains the original playback speed without relying on tempo change messages, thereby preventing discrepancies when imported into Digital Audio Workstations (DAWs).
Features
- Remove Tempo Changes: Strips all tempo change messages from the MIDI file.
- Preserve Playback Speed: Recalculates delta times of all MIDI events based on a constant tempo derived from the original file's starting tempo.
- Maintain Synchronization: Ensures that multiple tracks remain perfectly synchronized without drifting.
- Easy to Use: Operates via the command line and outputs a new MIDI file with a simple naming convention.
Usage
Run the script from the command line by providing the path to your input MIDI file. The script will generate a new MIDI file with _tempo appended to the original filename.
python baketempo.py path/to/your_input_file.mid
Example
Suppose you have a MIDI file named song.mid located in the current directory. To bake its tempo, execute:
python baketempo.py song.mid
This command will produce a new file named song_tempo.mid in the same directory.
Requirements
- Python: Ensure you have Python installed on your system. You can download it from python.org.
- mido Library: This project relies on the
midoMIDI library.
Installation
-
Clone the Repository:
git clone http://gitea.opentesla.org/melancholytron/TMmidis.git -
Navigate to the Project Directory:
cd TMmidis -
Install Required Python Libraries:
pip install mido
Contributing
Contributions are welcome! Please submit a pull request or open an issue to discuss changes.
Disclaimer
⚠️ Important: Always back up your original MIDI files before performing any operations to prevent accidental data loss.