Skip to content

Latest commit

 

History

History
80 lines (67 loc) · 3.13 KB

README.md

File metadata and controls

80 lines (67 loc) · 3.13 KB

MIDI Visualizer

Gtk application to visualize MIDI file as piano tutorial videos.

A project for the course Multimedium Computing Environment (National Taiwan University, 2018 Spring).

Here's preview of MIDI visualizer

Build Environment

Ubuntu

$ sudo apt install python3-venv python3-pip gstreamer1.0-plugins-bad ffmpeg libffi-dev
$ make start

The Makefile script downloads a soundfont (249 MB) and creates virtualenv environment.

Windows

  1. Install Python 3.4
    • Noted that PyGObject for Windows do not support Python 3.5 or above
  2. Install PyGObject for Windows
    1. Choose these items in GNOME libraries:
      • Base packages
      • Gst-plugins
      • Gst-plugins-extra
      • Gst-plugins-more
      • Gstreamer
      • GTK+
      • JSON-glib
    2. Choose none in non-GNOME libraries
    3. Choose none in development packages
  3. Open the cmd.exe to prepare for installing dependencies
    > python -m pip install --upgrade pip
    > pip install requests pycparser
  4. Download wheel packages from Unofficial Windows Binaries for Python Extension Packages
    • cffi‑1.11.5‑cp34‑cp34m‑win_amd64.whl
    • moviepy‑0.2.3.4‑py2.py3‑none‑any.whl
  5. Open the cmd.exe again to install dependencies
    > pip install cffi‑1.11.5‑cp34‑cp34m‑win_amd64.whl
    > pip install moviepy‑0.2.3.4‑py2.py3‑none‑any.whl
    > pip install gizeh mido intervaltree
  6. Open C:\Python34\Lib\site-packages\cairocffi\__init__.py
    • Change line 41 and save
      - cairo = dlopen(ffi, 'cairo', 'cairo-2')
      + cairo = dlopen(ffi, 'cairo', 'cairo-2', 'cairo-gobject-2')
  7. Download soundfont from musical-artifacts.com, save it to soundfont/touhou.sf2
  8. Execute python3 src/main.py

Details Explanation

Pipeline for Playing Video

pipeline diagram when playing

Pipeline for Saving Video

pipeline diagram when saving

Credits

  1. Gtk framework
    • Gtk+: a multi-platform toolkit for creating graphical user interfaces
    • Gstreamer: a library for constructing graphs of media-handling components
  2. Dependent packages
    • gizeh: a Python library for vector graphics
    • moviepy: a Python library for video editing
    • mido: a library for working with MIDI messages and ports
    • intervaltree: a mutable, self-balancing interval tree
  3. Resources