Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Wally869/MidiSplitter
Script to split midi files from a folder, into subsegments. The intent is to extract "patterns" from individual tracks and save them as individual Midi Files
https://github.com/Wally869/MidiSplitter
analysis midi midi-files midi-parser music music-analysis music-generation music-theory python
Last synced: 3 months ago
JSON representation
Script to split midi files from a folder, into subsegments. The intent is to extract "patterns" from individual tracks and save them as individual Midi Files
- Host: GitHub
- URL: https://github.com/Wally869/MidiSplitter
- Owner: Wally869
- Created: 2020-05-06T13:16:47.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-28T16:12:40.000Z (almost 4 years ago)
- Last Synced: 2024-04-06T19:35:28.041Z (7 months ago)
- Topics: analysis, midi, midi-files, midi-parser, music, music-analysis, music-generation, music-theory, python
- Language: Python
- Homepage:
- Size: 55.7 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MidiSplitter
### Overview
Script to split midi files from a folder, into subsegments.
The intent is to extract "patterns" from individual tracks### Dependencies
from pip: glob, mido, numpy, gooey
from github: MusiStrata (my repo: https://github.com/Wally869/MusiStrata)
### Usage
ADDED GOOEY SUPPORT
Can be called directly from cmd
the inputfolder argument can take lists so it is possible to operate on multiple folders at once```
# No args
python Splitter.py# see argparse parameters
python Splitter.py -h
usage: Splitter.py [-h] [-inputfolder INPUTFOLDER]
[-outputfolder OUTPUTFOLDER] [-minmessages MINMESSAGES]
[-exclusionmultiplier EXCLUSIONMULTIPLIER]
[-useinstrumentsound USEINSTRUMENTSOUND]Split Midi Songs
optional arguments:
-h, --help show this help message and exit
-i INPUTFOLDER [INPUTFOLDER ..]
-o OUTPUTFOLDER
-m MINMESSAGES
Prune tracks with less midi messages than this number
-e EXCLUSIONMULTIPLIER
Multiplier for timedelta messages. Median of timedelta
multiplied by this determines section splitting
-u USEINSTRUMENTSOUND
Use the track instrument, or default to Acoustic Grand Piano
```### Output
An input file of name "test.mid" will be output in a serie of mid files using the following naming scheme:
Track{TrackID}_{TrackInstrument}-{SectionID}.mid
A report is also generated per song under the name "-----SplitterReport-----.txt".
It tracks some metrics, such as number of tracks before/after split, total number of segments,
number of segments kept.It also records parameters used when splitting, and gives a breakdown of the segments recorded
To Note: some segments can be excluded so SectionID is not guaranteed to be continuous
A sample report:
```text
Filename: InputSplitter\test.mid
NbTracksBeforeSplit: 22
NbTracksAfterSplit: 12
NbSegmentsTotal: 46
NbSegmentsKept: 25Minimum Messages: 20
Exclusion Multiplier: 5==========
Channel: 0
Instrument: Acoustic Grand Piano
NbMessages: 703==========
Channel: 1
Instrument: Acoustic Grand Piano
NbMessages: 198==========
Channel: 2
Instrument: Acoustic Grand Piano
NbMessages: 503```
### To Do
- Better threshold selection than naive full-song median multiplication, and do it by channel
- Implement threading (writing midi can be bottleneck I guess? Or handle songs seperately)
- Fix errors whenever possible