All Projects → mathigatti → midi2img

mathigatti / midi2img

Licence: MIT license
MIDI to image and image to MIDI conversion scripts

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to midi2img

Dx7 Synth Js
A JavaScript implementation of the Yamaha DX7 synthesizer
Stars: ✭ 201 (+318.75%)
Mutual labels:  midi
Opendeck
Software and hardware platform for simpler building of MIDI controllers.
Stars: ✭ 232 (+383.33%)
Mutual labels:  midi
Adlplug
FM Chip Synthesizer — OPL & OPN — VST/LV2/Standalone
Stars: ✭ 249 (+418.75%)
Mutual labels:  midi
Isobar
A Python library for creating and manipulating musical patterns, designed for use in algorithmic composition, generative music and sonification. Can be used to generate MIDI events, MIDI files, OSC messages, or custom events.
Stars: ✭ 207 (+331.25%)
Mutual labels:  midi
Timidity
Play MIDI files in the browser w/ Web Audio, WebAssembly, and libtimidity
Stars: ✭ 221 (+360.42%)
Mutual labels:  midi
Midimonster
Multi-protocol control & translation software (ArtNet, MIDI, OSC, sACN, ...)
Stars: ✭ 241 (+402.08%)
Mutual labels:  midi
Python Rtmidi
Python bindings for the cross-platform MIDI I/O library RtMidi
Stars: ✭ 189 (+293.75%)
Mutual labels:  midi
Pedalino
Smart wireless MIDI foot controller for guitarists and more.
Stars: ✭ 105 (+118.75%)
Mutual labels:  midi
Unimidi
Realtime MIDI IO for Ruby
Stars: ✭ 229 (+377.08%)
Mutual labels:  midi
Usb Midi Driver
USB MIDI Driver for Android 3.1 or later
Stars: ✭ 244 (+408.33%)
Mutual labels:  midi
Moppy2
The evolution of the Musical flOPPY controller
Stars: ✭ 207 (+331.25%)
Mutual labels:  midi
Midir
Cross-platform realtime MIDI processing in Rust.
Stars: ✭ 221 (+360.42%)
Mutual labels:  midi
Mt32 Pi
🎹🎶 A baremetal kernel that turns your Raspberry Pi 3 or later into a Roland MT-32 emulator and SoundFont synthesizer based on Circle, Munt, and FluidSynth.
Stars: ✭ 231 (+381.25%)
Mutual labels:  midi
Drywetmidi
.NET library to read, write, process MIDI files and to work with MIDI devices
Stars: ✭ 204 (+325%)
Mutual labels:  midi
Chataigne
Artist-friendly Modular Machine for Art and Technology
Stars: ✭ 251 (+422.92%)
Mutual labels:  midi
Midiplayerjs
♬ Midi parser & player engine for browser or Node. As a parser converts MIDI events into JSON. Works well with single or multitrack MIDI files.
Stars: ✭ 199 (+314.58%)
Mutual labels:  midi
Iannix
IanniX is a graphical open-source sequencer, based on Iannis Xenakis works, for digital art. IanniX syncs via Open Sound Control (OSC) events and curves to your real-time environment.
Stars: ✭ 238 (+395.83%)
Mutual labels:  midi
webaudio-synth
WebAudio Polyphonic Synthesizer
Stars: ✭ 83 (+72.92%)
Mutual labels:  midi
oddvoices
An indie singing synthesizer
Stars: ✭ 4 (-91.67%)
Mutual labels:  midi
Midianimationtrack
SMF (.mid) file importer for Unity Timeline
Stars: ✭ 243 (+406.25%)
Mutual labels:  midi

MIDI to Image conversion

Convert MIDI files into piano roll images and back with this Python script.

Demo

Here is a video demonstration using the program to generate midis and images, then we use it for an artistic performance.

IMAGE ALT TEXT HERE

Implementation Details

This script relies on the music21 library to parse and create MIDI files. The expected images are black and white and have a fixed size of 106 rows and 100 columns. 106 is the number of different notes (From 21 (A0) to 127 (G9)) and 100 is the length of the song, if a song is longer than that the script splits the song and generates several images. Each image represents one instrument, if a song has several instruments different images are generated for each. Each pixel represents a note played for 1/4 beats, this can be changed with the resolution variable.

Requirements

  • python 3
  • python packages (Try something like: pip install -r requirements.txt)
    • music21
    • imageio
    • numpy
    • Pillow

Usage

There are two scripts, one for converting a MIDI into images and the other one to convert an image into a MIDI.

MIDI to Image

REPETITIONS is an optional parameter which indicates, in case the song is too long, how many parts of the song to convert into an image. If it is 1 it only extracts the first part of the song. If you don't specify it then it generates as many images as needed to cover all the song.

python midi2img.py MIDI_FILE_PATH REPETITIONS
python midi2img.py samples/zelda.mid 1

Using the sample zelda midi the generated image for the first part of the song looks like this

Image to MIDI

Converts image of size (106,100) into a midi file.

python img2midi.py IMAGE_PATH
python img2midi.py samples/image.png

Using the image from the sample folder it generates as expected a midi file with decreasing and increasing notes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].