Skip to main content

A python library that allows you to export a video in which a piano is playing the music you give it.

Project description

piano_visualizer

A python library that allows you to export a video in which a piano is playing the music you give it.

example gif

Features

  • Export a video of a custom midi file
  • Easy interface
  • Multi-core export
  • Multiple piano support
  • Multiple midi support
  • Automatically generate audio for midi files

How to

piano_visualizer was built with the intent to for it to be simple to use. You can render a piano video with simply 4 lines of code!

There are 2 main classes: Piano and Video Piano takes care of the piano rendering and the midi file parsing Video takes care of video management (fps, resolution) and exporting

INSTALL pip install piano_visualizer

Working in example.py

# Import the library after you have installed it
import piano_visualizer

# Create a piano with a midi file(s)
piano = piano_visualizer.Piano(["/path/to/your/midi/file.mid"])

# Create a video with resolution/fps
video = piano_visualizer.Video((1920, 1080), 30)

# Add piano to video
video.add_piano(piano)

# Export video on multiple cores (1 for single)
video.export("your/export/path.mp4", num_cores=6)

# You can add music too! (although it is sometimes offset from video)
# video.export("your/export/path.mp4", num_cores=6, music=True)

# Progress bars should show up
# Once your video is exported it will be at the path you specified!

NOTE: For music to work, you need fluidsynth

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

piano_visualizer-1.1.0.tar.gz (18.7 kB view hashes)

Uploaded Source

Built Distribution

piano_visualizer-1.1.0-py3-none-any.whl (19.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page