{"id":15551266,"url":"https://github.com/phuang1024/piano_vis","last_synced_at":"2025-04-15T21:48:42.016Z","repository":{"id":57452471,"uuid":"326114052","full_name":"phuang1024/piano_vis","owner":"phuang1024","description":"A Python piano video exporter. Newer repository here: https://github.com/huangpatrick16777216/piano_video","archived":false,"fork":false,"pushed_at":"2021-05-03T04:41:08.000Z","size":1793,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-15T21:48:38.501Z","etag":null,"topics":["opencv","piano","pianovis","pygame","python","video"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phuang1024.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-02T05:16:10.000Z","updated_at":"2025-01-24T06:31:48.000Z","dependencies_parsed_at":"2022-08-30T01:10:37.693Z","dependency_job_id":null,"html_url":"https://github.com/phuang1024/piano_vis","commit_stats":null,"previous_names":["huangpatrick16777216/piano_vis"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phuang1024%2Fpiano_vis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phuang1024%2Fpiano_vis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phuang1024%2Fpiano_vis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phuang1024%2Fpiano_vis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phuang1024","download_url":"https://codeload.github.com/phuang1024/piano_vis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249161104,"owners_count":21222468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["opencv","piano","pianovis","pygame","python","video"],"created_at":"2024-10-02T14:03:39.107Z","updated_at":"2025-04-15T21:48:41.996Z","avatar_url":"https://github.com/phuang1024.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![logo](pianovis/images/logo_large.png)\n\n\n# PianoVis 0.2.1\n\nA Python piano video exporter.\n\nExamples:\n* [Papillon (Grieg)](https://www.youtube.com/watch?v=mUAQ6-2oa2w)\n* [Impromptu Rosamunde (Schubert)](https://www.youtube.com/watch?v=y0lmpqP2AGY)\n* [Sonatina (Clementi)](https://www.youtube.com/watch?v=kfebLsnU1qE)\n\n\u003cbr\u003e\n\n\n## Quick Start\n\n1. Install PianoVis: `pip install piano-vis`\n    * Dependencies:\n        * pygame\n        * opencv-python\n        * mido\n        * colorama\n        * vext (optional, for playing sound during preview)\n        * vext.gi (optional, for playing sound during preview)\n        * playsound (optional, for playing sound during preview)\n        * win10toast (only on Windows)\n2. Follow this code format:\n```python3\nimport pianovis\n\nresolution = (1920, 1080)\nfps = 30\noffset = 1\n\nvid = pianovis.Video(resolution, fps, offset)\nvid.add_midi(\"midi1.mid\")\nvid.add_midi(\"midi2.mid\")\nvid.set_audio(\"audio.mp3\")\nvid.export(\"video.mp4\")\n```\n\n\u003cbr\u003e\n\n\n## pianovis.Video\n\n`pianovis.Video` is the main video class which stores all midi and audio files, and exports the final video.\n* `Video.__init__(resolution: Tuple[int, int], fps: int, offset: int) -\u003e None`\n    * Initializes video.\n    * `resolution`: (x, y) pixel resolution of video.\n    * `fps`: FPS (frames per second) of video.\n    * `offset`: Offset (frames) of video from audio. Usually, a value of 1 makes the video look lined up with the audio.\n    * `decor_surf`=None Decoration surface, blitted under the piano.\n* `Video.configure(path: str, value: Any) -\u003e None`\n    * Sets an option for the video (read more in the Customization section).\n    * `path`: Option path.\n    * `value`: Value to set path to.\n* `Video.add_midi(path: str) -\u003e None`\n    * Appends path to midi list.\n    * `path`: Midi file path.\n* `Video.set_audio(path: str) -\u003e None`\n    * Sets audio file to path.\n    * `path`: Audio file path.\n* `Video.preview(resolution: Tuple[int, int] = (1600, 900), show_meta: bool = True) -\u003e None:`\n    * Opens a pygame window to preview the animation.\n    * `resolution`=(1600, 900): Resolution of pygame window.\n    * `show_meta`=True: Show metadata in the corner of window.\n    * `audio`=True: Play audio along preview.\n* `Video.export(self, path: str, multicore: bool = False, max_cores: int = multiprocessing.cpu_count(), notify: bool = False) -\u003e None:`\n    * Exports video to path.\n    * `path`: Path to export (mp4)\n    * `multicore`=False: Use multiple cores to export. Can be faster, but will take more power.\n    * `max_cores`=multiprocessing.cpu_count(): Maximum cores to use. Only relevant if using multicore.\n    * `notify`=False: Sends notification when done exporting. Requires `win10toast` on Windows.\n\n\u003cbr\u003e\n\n\n## Customization\n\nRun `Video.configure` to change options.\n* `keys.white.gap`: Gap (pixels) between white keys.\n* `keys.white.color`: Color (RGB) of white keys.\n* `keys.black.width_fac`: Factor of white key width.\n* `keys.black.height_fac`: Factor of white key height.\n* `keys.black.color`: Color (RGB) of black keys.\n* `blocks.speed`: Speed (pixels per second) of blocks.\n* `blocks.border`: Border width (pixels) of blocks.\n* `blocks.color_grad`: Color gradient of blocks: ((fac1, hsv1), (fac2, hsv2)...)\n* `blocks.color_hue`: Hue adjustment (additive) to color.\n* `blocks.color_saturation`: Saturation adjustment (multiplicative) to color.\n* `blocks.color_value`: Value adjustment (multiplicative) to color.\n* `blocks.color_border`: Color (RGB) of border.\n* `blocks.rounding`: Rounding radius of blocks.\n* `blocks.motion_blur`: Use motion blur in blocks.\n* `blocks.light`: Light up blocks when hit. Still in development.\n\n\u003cbr\u003e\n\n\n## How It Works\n\n* The user adds midis and sets an audio.\n* When the user calls `Video.export`, a few things happen:\n    * All midis are parsed.\n    * Single core:\n        * Each frame is rendered with pygame, saved, and encoded with opencv.\n        * All temporary files are deleted.\n    * Multi core:\n        * Each core is assigned a chunk of frames and renders and saves them.\n        * Each frame is encoded with opencv.\n        * All temporary files are deleted.\n    * The audio is combined with video with ffmpeg.\n\n## Extras\n\n#### Constants (`pianovis.constants`)\n_Note: pianovis.BLACK == pianovis.constants.BLACK_\n* Colors (Normalized HSV)\n* Block color gradient presets.\n\n#### App (`pianovis.app`)\n* Create piano videos in a GUI.\n* Currently version 1 (in development)\n* Run `pianovis.app.launch()` to launch the latest version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphuang1024%2Fpiano_vis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphuang1024%2Fpiano_vis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphuang1024%2Fpiano_vis/lists"}