Metadata-Version: 2.3
Name: midi-neural-processor
Version: 1.0.3
Summary: Tokenize MIDI files for neural network processing
Project-URL: Repository, https://github.com/johacks/midi-neural-processor
Author-email: Kevin Yang <ykcha9@gmail.com>, Hao Hao Tan <helloharry66@gmail.com>, johacks <joaquinjimenezlc@gmail.com>
Maintainer-email: johacks <joaquinjimenezlc@gmail.com>
Keywords: midi,midi-processor,midi-tokenizer,music,neural,processor,tokenizer
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: pretty-midi>=0.2.8
Requires-Dist: setuptools>=43.0.0
Description-Content-Type: text/markdown

# Midi Neural Processor (Fork)

**This repository is a fork of [this](https://github.com/jason9693/midi-neural-processor) repo with the main objective of structuring as an installable python package via pip.**

* Repository for midi-based machine learning model's {pre/post} processing.
* You can use this processor in any machine learnig library like tensorflow, pytorch, etc...

* This processor's algorithm is based on [PerformanceRNN](https://magenta.tensorflow.org/performance-rnn) & [Music Transformer (Polyphonic Music)](https://arxiv.org/abs/1809.04281) Model's preprocessing algorithm suggested by Google Magenta.

## Simple Usage

### Install

```bash
$ pip install midi-neural-processor
```

### Encoding & Load midi file

* You can load & encode your midi file just one line
* encode_midi() is a role of pre-processing.

```python
from midi_neural_processor.processor import encode_midi
encoded = encode_midi('bin/ADIG04.mid') ## 'bin/AIDG04.mid' is midi file path.
## output: [int, int, int, int, ... ].
## int range is range(0,388). 388 = NOTE_ON + NOTE_OFF + TIME_SHIFT + VELOCITY 
```

### Decoding

* decode_midi is convert integer array to midi form.
* you can gave method to ***file_path*** as a second args in that if you want to save midi as .mid file. 
* all elements in integer array should be range(0,388). 

```python
from midi_neural_processor.processor import decode_midi
decode_midi(encoded, 'bin/test.mid') ## 'bin/test.mid' is midi file path.
```

## Comming Soon

1. Pedal Control
2. Midi Converter to .tfrecords

## License

Project is published under the MIT licence. Feel free to clone and modify repo as you want, but don't forget to add reference to authors :)

 
