PianoVis 0.2.1
A Python piano video exporter.
Examples:
Quick Start
- Install PianoVis:
pip install piano-vis- Dependencies:
- pygame
- opencv-python
- mido
- colorama
- vext (optional, for playing sound during preview)
- vext.gi (optional, for playing sound during preview)
- playsound (optional, for playing sound during preview)
- win10toast (only on Windows)
- Dependencies:
- Follow this code format:
import pianovis
resolution = (1920, 1080)
fps = 30
offset = 1
vid = pianovis.Video(resolution, fps, offset)
vid.add_midi("midi1.mid")
vid.add_midi("midi2.mid")
vid.set_audio("audio.mp3")
vid.export("video.mp4")
pianovis.Video
pianovis.Video is the main video class which stores all midi and audio files, and exports the final video.
Video.__init__(resolution: Tuple[int, int], fps: int, offset: int) -> None- Initializes video.
resolution: (x, y) pixel resolution of video.fps: FPS (frames per second) of video.offset: Offset (frames) of video from audio. Usually, a value of 1 makes the video look lined up with the audio.decor_surf=None Decoration surface, blitted under the piano.
Video.configure(path: str, value: Any) -> None- Sets an option for the video (read more in the Customization section).
path: Option path.value: Value to set path to.
Video.add_midi(path: str) -> None- Appends path to midi list.
path: Midi file path.
Video.set_audio(path: str) -> None- Sets audio file to path.
path: Audio file path.
Video.preview(resolution: Tuple[int, int] = (1600, 900), show_meta: bool = True) -> None:- Opens a pygame window to preview the animation.
resolution=(1600, 900): Resolution of pygame window.show_meta=True: Show metadata in the corner of window.audio=True: Play audio along preview.
Video.export(self, path: str, multicore: bool = False, max_cores: int = multiprocessing.cpu_count(), notify: bool = False) -> None:- Exports video to path.
path: Path to export (mp4)multicore=False: Use multiple cores to export. Can be faster, but will take more power.max_cores=multiprocessing.cpu_count(): Maximum cores to use. Only relevant if using multicore.notify=False: Sends notification when done exporting. Requireswin10toaston Windows.
Customization
Run Video.configure to change options.
keys.white.gap: Gap (pixels) between white keys.keys.white.color: Color (RGB) of white keys.keys.black.width_fac: Factor of white key width.keys.black.height_fac: Factor of white key height.keys.black.color: Color (RGB) of black keys.blocks.speed: Speed (pixels per second) of blocks.blocks.border: Border width (pixels) of blocks.blocks.color_grad: Color gradient of blocks: ((fac1, hsv1), (fac2, hsv2)...)blocks.color_hue: Hue adjustment (additive) to color.blocks.color_saturation: Saturation adjustment (multiplicative) to color.blocks.color_value: Value adjustment (multiplicative) to color.blocks.color_border: Color (RGB) of border.blocks.rounding: Rounding radius of blocks.blocks.motion_blur: Use motion blur in blocks.blocks.light: Light up blocks when hit. Still in development.
How It Works
- The user adds midis and sets an audio.
- When the user calls
Video.export, a few things happen:- All midis are parsed.
- Single core:
- Each frame is rendered with pygame, saved, and encoded with opencv.
- All temporary files are deleted.
- Multi core:
- Each core is assigned a chunk of frames and renders and saves them.
- Each frame is encoded with opencv.
- All temporary files are deleted.
- The audio is combined with video with ffmpeg.
Extras
Constants (pianovis.constants)
Note: pianovis.BLACK == pianovis.constants.BLACK
- Colors (Normalized HSV)
- Block color gradient presets.
App (pianovis.app)
- Create piano videos in a GUI.
- Currently version 1 (in development)
- Run
pianovis.app.launch()to launch the latest version.
Metadata
Release files for piano-vis 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| piano-vis-0.2.1.tar.gz | 11.7 kB | Without provenance | Details for piano-vis-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| piano_vis-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for piano_vis-0.2.1-py3-none-any.whl |
Total release size: 39.0 kB
Release files / piano-vis-0.2.1.tar.gz
| Download URL | piano-vis-0.2.1.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9e5919ae023c23d2cdbf88ad6bea2742bc49d1281d158739cf87d3b1365b4d20
|
|
BLAKE2b-256 checksum How to use checksums |
96c189c2e9e9a30180b4e857c43ad1fd6cb7f3112cde3c6d33e569846a8eec41
|
| 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/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0
|
Release files / piano_vis-0.2.1-py3-none-any.whl
| Download URL | piano_vis-0.2.1-py3-none-any.whl |
|---|---|
| Size | 27.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e9fbcd36ba7def341cdabdabbd9a6093afb83da6ac4f82d91331263cdabd0dc
|
|
BLAKE2b-256 checksum How to use checksums |
79429416ab64c61a1d5e7e6754d653f0befb3b6bb9c10a3cf3cb8d522c6126e1
|
| 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/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.0
|
Security for piano-vis 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.