Controlling my Computer using a MIDI Keyboard

For source code, check out this project’s GitHub page:

I like to play piano, and sometimes I like to watch videos on Youtube while I’m playing. However, it gets kind of tedious having to switch back and forth between my computer and my piano, so I decided to challenge myself making a program, which enables me to control my computer from my keyboard.

I found some code on StackOverflow, which makes it possible to listen to the input from a MIDI device. I then took this code and incorporated it with the Robot-class in java.awt.*, which makes it possible emulate keyboard presses and mouse clicks.

Currently, you have to hold down the low A (the lowest note on my piano) and press some of the buttons to move the mouse, click etc.


  • F2 – Move mouse slightly left
  • F#2 – Move mouse slightly up
  • G2 – Move mouse slightly down
  • G#2 – Move mouse slightly right
  • Bb2 – Page Up
  • B2 – Page Down
  • C3 – Move mouse left
  • C#3 – Move mouse up
  • D3 – Move mouse down
  • D#3 – Move mouse right
  • E3 – Left click
  • F3 – Right click
  • F#3 – Enter
  • G3  – Space
  • G#3 – Escape

I plan to make more commands soon (including New TabClose Tab, and others), but as of now, this will do.

This is one of the simplest programs I’ve made recently, but I just like it’s application.


One thought on “Controlling my Computer using a MIDI Keyboard

Comment on this article

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s