Skip to main content

midi2Tiles

Demo

About

This tool create synthesia-like piano tiles effect from midi files.

Although Synthesia provides nice animation, it is not for free. Hence, I use matplotlib to create the piano tiles animation.

The output video can futher be imported in video editting software such as After Effects as an overlay of your video.

Install

pip install midi2Tiles

Usage

# some video settings
VIDEO_DPI = 1000
VIDEO_FPS = 60
VIDEO_WIDTH = 1080
VIDEO_HEIGHT = 720

# the proportion of keyboard display
KB_RATIO = 0.1

# speed of the falling tiles (pixels per sec)
# notice that this value also affect the height of each tile
TILE_VELOCITY = 500

from midi2Tiles import pianoTileCreator

ptc = pianoTileCreator.PianoTileCreator(video_width=VIDEO_WIDTH,
                                        video_height=VIDEO_HEIGHT,
                                        video_dpi=VIDEO_DPI,
                                        video_fps=VIDEO_FPS,
                                        KB_ratio=KB_RATIO,
                                        tile_velocity=TILE_VELOCITY,
                                        key_color="green",
                                        showKeyVelocity=True)
ptc.loadMidiFile("<input midi file>",verbose=True)
ptc.render("<output video file>",verbose=True)

Parameters

  • video_width (int): the width of the output video (px)
  • video_height (int): the height of the output video (px)
  • video_dpi (int): the dpi of the output video (px)
  • video_fps (int): the fps of the output video (px)
  • KB_ratio (float): the proportion of the piano keyboard display. This value should be in [0,1)
  • tile_velocity (int): the velocity of the falling tiles
  • key_color (string): the color of the tiles
  • showKeyVelocity (bool): if True, the velocity of midi notes will affect the opacity of the tiles

Author

Ian Shih Email: yjshih23@gmail.com

Acknoledgement

The ratio of the piano design is referenced from https://github.com/gin66/piano_keyboard

Metadata

Release files for midi2Tiles 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for midi2Tiles 1.0.2
File Size Uploaded
midi2Tiles-1.0.2.tar.gz 301.6 kB Details

Release files / midi2Tiles-1.0.2.tar.gz

Download URL midi2Tiles-1.0.2.tar.gz
Size 301.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d3e0862a6ef172314b037c9bcd860e5bce9d965182a000a66f197dcb3ab4edd3
BLAKE2b-256 checksum
How to use checksums
9062b2c82765b2d2f33a16439d57d88bc3d8c19656184fde688b21007e890eb9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.2

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page