Giter Club home page Giter Club logo

midi-neural-processor's Introduction

Midi Neural Processor

  • 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 & Music Transformer (Polyphonic Music) Model's preprocessing algorithm suggested by Google Magenta.

Simple Useage

Download

$ git clone https://github.com/jason9693/midi-processor.git

Encoding & Load midi file

  • You can load & encode your midi file just one line
  • encode_midi() is a role of pre-processing.
from 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).
from 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 :)

midi-neural-processor's People

Contributors

gudgud96 avatar jason9693 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

midi-neural-processor's Issues

decoder-encoder process is not `Reversible`

Hi,

I've tried the following procedure:

arr = np.random.random_integers(21, 387, size=20000)
decode_midi(arr, "a.midi")
idx = np.random.random_integers(0, 20000, 100)
print(arr[idx])

arr = np.array(encode_midi("a.midi"))
print(arr[idx])

However, the encoding process gives me an empty result.

empty susteins

hi , is it possible that the function _note_preprocess get an empty list susteins ? (Line 181)
Thanks!

Empty output on anything other than MAESTRO MIDIs

Hey Kevin!

How are you? I hope you are doing well in these difficult times...

I am just reporting that the processor does not work with regular MIDI files. It only works with MAESTRO MIDIs and when you try to convert any other MIDI you get the empty output.

I would be very grateful to you if you can fix it because your Processor is amazing and it is very much needed right now for open-source Music AI development.

Thank you.

Whenever you have time.

little velocity error

def _snote2events(snote: SplitNote, prev_vel: int):
result = []
if snote.velocity is not None:
modified_velocity = snote.velocity // 4
if prev_vel != modified_velocity:
result.append(Event(event_type='velocity', value=modified_velocity))
result.append(Event(event_type=snote.type, value=snote.value))
return result

prev_vel != modified_velocity line seems to be wrong,
it should be prev_vel != snote.velocity

C++ version

Is it possible to rewrite your functions in c++? And maybe you know something about existing ones? Thank you!

FYI: Available MIDI processor alternative

@jason9693 and others who are interested:

Since it seems that this repo/code/project is abandoned atm, not to mention that the code does not work properly, here is the alternative that I have created and that is compatible with Kevin's work/similar to his processor.

https://github.com/asigalov61/tegridy-tools/blob/main/tegridy-tools/TMIDI.py

This module includes several different MIDI processors so you can choose the one you like best or the one that works best with your particular project/implementation.

@jason9693 I hope you do not mind that I post it here but a few people have been asking so I figured I will leave a link.
Otherwise, your work was very useful and helpful in reproducing the Google Piano Transformer. Myself and Damon are very close to reproducing the results but we had to move away from your code cuz you don't support it atm. I hope you understand.

Thanks again.

Alex.

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.