Git Product home page Git Product logo

virtual-sheet-magic's Introduction

virtual-sheet-magic

Features

  • Parse sheets into JSON with MIDI value indices and pause values (depends on JSONS, may be reimplemented)
  • Play virtual piano sheets
  • TODO: Play MIDI files as virtual piano keys
  • TODO: Make, edit and listen to virtual piano sheets

Notes

Unfortunately, a lot of virtual piano sheets do not have appropriate pausing; they are made to be played more according to the feel and your knowledge of the song. You may need to adjust the sheet with an editor of your choice and use the following symbols to pause appropriately.

  • ' (1/16)
  • |, - (1/8)
  • = (1/4)
  • : (1/2)

You can adjust individual note value by appending symbols to keys as well.

  • < (to divide rhythmic value by 2 per each < symbol, 1/8 -> 1/16 -> 1/32 -> 1/64...)
  • > (to multiply rhythmic value by 2 per each > symbol, 1/8 -> 1/4 -> 1/2 -> 1...)

Additionally, you can use chords to play multiple keys at once.

  • [] - play keys simultaneuosly
  • {} - play keys near simultaneously, where each note has a rhythmic value of 1/32

Installation

Set up virtual-sheet-magic in a virtualenv - this way, you will not pollute your system-wide install.
(If you know how to package Python projects, feel free to fork & submit a pull request.)

$ python -m virtualenv .venv && source .venv/bin/activate && pip install -r requirements.txt

keyboard versus pynput

At the time of writing, pynput on Windows sends simulated keypresses which may not work with all applications.
However, on Linux, keyboard requires root access, which is rather inconvenient and a potential security risk.

By default, the program uses pynput as it should work for most scenarios. If you're on Windows and an application is not receiving keystrokes, try using --input-wrapper keyboard when you play a sheet.

Usage

positional arguments:
  {play,p,parse}
    play (p)      Plays a virtual sheet from `stdin`. Outputs seeker value on exit to `stdout`

options:
  -h, --help      show this help message and exit

play

play [-h] [--input-wrapper INPUT_WRAPPER] [--seek SEEK] [--tempo TEMPO] [--newline-pauses]

options:
  -h, --help            show this help message and exit
  --input-wrapper INPUT_WRAPPER, -w INPUT_WRAPPER

                        Use an input wrapper preferable to your system configuration
                        	pynput - preferable on X11, macOS
                        	keyboard - preferable on Microsoft Windows
  --seek SEEK, -s SEEK  Start the player at the provided number (measured in notes)
  --tempo TEMPO, -t TEMPO

                        Overrides the tempo of the sheet being played.
                        If not provided, uses the sheet's tempo or default (120)
  --newline-pauses, -N  Toggle whether a newline should count as a `|` (pause) note

Example usage

Browse around Virtual Piano's collection of sheets and copy into clipboard or save into a file to try it out.

$ python main.py play -t 110 < my-vp-sheet.txt
$ sleep 1; python main.py play -t 110 < my-vp-sheet.txt
$ xclip -o | python main.py play -t 160
$ sleep 1; xclip -o | python main.py play -s echo $([ -f /tmp/seeker-stopped-at ] && cat /tmp/seeker-stopped-at || echo 0) -t 160 > /tmp/seeker-stopped-at

virtual-sheet-magic's People

Contributors

4xmsaa avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.