Giter Club home page Giter Club logo

virtual-piano's Introduction

Virtual Piano

Play piano (or any instrument) using your computer keyboard in a positionally-natural manner! Play any of the 128 provided MIDI instruments! Simulate sustain pedal! (by holding space bar)

This program is running in Java Virtual Machine, using Java MIDI library.

How to run

Run the class main.VirtualPiano.java

Keyboard use

(3rd and 4th rows of qwerty keyboard)
zsxdcvgbhnjm           = C C# D ... through B, first octave

(1st and 2nd rows of qwerty keyboard)
q2w3er5t6y7u           = C C# D ... through B, second octave
i9o0p[=] BKSPC BKSLASH = C C# D ... through A, third octave

spacebar               = sustain pedal

left arrow             = previous instrument
right arrow            = next instrument

page up                = change octave +1
page dn                = change octave -1

enter                  = reset (stop all notes)

Instruments

The list of MIDI instruments correspond to the standard list (you can find it on the web). Some highlights:

0   acoustic grand piano
40  violin
73  flute
123 bird tweet

Mouse use

If you want to enable mouse use, modify the source code on file Piano.java (uncomment code in PianoMouseListener) and rebuild.

About the source code

There are resource files in the project. If your IDE's compiler does not recognize some of the resource files, please modify your IDE settings to recognize resource files with those file extensions. (e.g. IntelliJ has problem running in the first attempt)

Troubleshooting

There is no sound!

Remember that this program uses MIDI sound. Please check if your volume settings for MIDI is not at zero level or muted.

If you are a Windows user, you may not have java soundbank. Just download one of this zipped sound files:

http://java.sun.com/products/java-media/sound/soundbank-min.gm.zip
http://java.sun.com/products/java-media/sound/soundbank-mid.gm.zip
http://java.sun.com/products/java-media/sound/soundbank-deluxe.gm.zip

(the last is the biggest file, 5 MB, but has the best quality sound)

Unzip it, and put the file in your "C:\Program Files\Java\jre1.6.0\lib\audio" folder. Your jre version may be different 1.6.0, but that's no problem. Just put it in the jreX.X.X\lib\audio directory.

In Linux, pressing a key results in the piano key being pressed rapidly multiple times

This is a known OS bug that affects many Linux distros. Unfortunately we can do nothing about it. A workaround is to set your keyboard settings (through system settings) to disable key repeats while you are using this program.

Sound quality is very bad

Well, it's MIDI :)

Note that different computers may produce different sounds. It really depends on your sound card / the embedded sound card being used.

Sometimes pressing many keys at the same time will produce an error beep instead of sounding a note

This is normal and is caused by the internal wiring of a computer keyboard. There are always some pairs of keys that cannot be pressed together in any keyboard. This affects all programs, not just this program. Unfortunately we can do nothing about it.

Why was this program written?

It was 2007. I just finished my first semester in college abroad, far away from home. It was unrealistic to fly home halfway across the globe, so during the time my school dormitory was closed during the winter break, my kind relatives let me stay in their house.

There was not much to do that could stimulate myself enough, so I decided to write a program to turn my computer keyboard into a piano keyboard, so I can play myself some little Christmas songs and other tunes in the cold workday afternoons, when the house was quiet and empty but my heart doesn't need to be.

END

virtual-piano's People

Contributors

derianto avatar astrapi69 avatar

Watchers

James Cloos avatar  avatar James Phelps avatar Leonardo da Sogno 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.