# 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 :)
Raw data
{
"_id": null,
"home_page": null,
"name": "midi-neural-processor",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "johacks <joaquinjimenezlc@gmail.com>",
"keywords": "midi, midi-processor, midi-tokenizer, music, neural, processor, tokenizer",
"author": null,
"author_email": "Kevin Yang <ykcha9@gmail.com>, Hao Hao Tan <helloharry66@gmail.com>, johacks <joaquinjimenezlc@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/1f/29/c81b800817ac64108f1784748aabca760b4612645b56c53499f60ced0371/midi_neural_processor-1.0.3.tar.gz",
"platform": null,
"description": "# Midi Neural Processor (Fork)\n\n**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.**\n\n* Repository for midi-based machine learning model's {pre/post} processing.\n* You can use this processor in any machine learnig library like tensorflow, pytorch, etc...\n\n* 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.\n\n## Simple Usage\n\n### Install\n\n```bash\n$ pip install midi-neural-processor\n```\n\n### Encoding & Load midi file\n\n* You can load & encode your midi file just one line\n* encode_midi() is a role of pre-processing.\n\n```python\nfrom midi_neural_processor.processor import encode_midi\nencoded = encode_midi('bin/ADIG04.mid') ## 'bin/AIDG04.mid' is midi file path.\n## output: [int, int, int, int, ... ].\n## int range is range(0,388). 388 = NOTE_ON + NOTE_OFF + TIME_SHIFT + VELOCITY \n```\n\n### Decoding\n\n* decode_midi is convert integer array to midi form.\n* you can gave method to ***file_path*** as a second args in that if you want to save midi as .mid file. \n* all elements in integer array should be range(0,388). \n\n```python\nfrom midi_neural_processor.processor import decode_midi\ndecode_midi(encoded, 'bin/test.mid') ## 'bin/test.mid' is midi file path.\n```\n\n## Comming Soon\n\n1. Pedal Control\n2. Midi Converter to .tfrecords\n\n## License\n\nProject 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 :)\n\n \n",
"bugtrack_url": null,
"license": null,
"summary": "Tokenize MIDI files for neural network processing",
"version": "1.0.3",
"project_urls": {
"Repository": "https://github.com/johacks/midi-neural-processor"
},
"split_keywords": [
"midi",
" midi-processor",
" midi-tokenizer",
" music",
" neural",
" processor",
" tokenizer"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "28fe528951e9994e3b2ca9cc6f86b81912cca338aafd53b3f990981aadb8b36c",
"md5": "5b91276a4605d711ef9af4a5ab1bf894",
"sha256": "5d915e194d738c50a63e20fab8922270de69ee5caa964bac507a6cbd183a559b"
},
"downloads": -1,
"filename": "midi_neural_processor-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5b91276a4605d711ef9af4a5ab1bf894",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5592,
"upload_time": "2024-11-25T08:39:19",
"upload_time_iso_8601": "2024-11-25T08:39:19.561991Z",
"url": "https://files.pythonhosted.org/packages/28/fe/528951e9994e3b2ca9cc6f86b81912cca338aafd53b3f990981aadb8b36c/midi_neural_processor-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1f29c81b800817ac64108f1784748aabca760b4612645b56c53499f60ced0371",
"md5": "c80e648eb9982958b9b3ebb59d4a8126",
"sha256": "7ade48a8861e692d187a24dcd01667e69634c7b77b0617cb87fd753f35b7b336"
},
"downloads": -1,
"filename": "midi_neural_processor-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "c80e648eb9982958b9b3ebb59d4a8126",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 10465,
"upload_time": "2024-11-25T08:39:21",
"upload_time_iso_8601": "2024-11-25T08:39:21.298650Z",
"url": "https://files.pythonhosted.org/packages/1f/29/c81b800817ac64108f1784748aabca760b4612645b56c53499f60ced0371/midi_neural_processor-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-25 08:39:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "johacks",
"github_project": "midi-neural-processor",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "midi-neural-processor"
}