Git Product home page Git Product logo

midisplitter's Introduction

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:

Filename: InputSplitter\test.mid
NbTracksBeforeSplit: 22
NbTracksAfterSplit: 12
NbSegmentsTotal: 46
NbSegmentsKept: 25

Minimum 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

midisplitter's People

Contributors

wally869 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.