Controlling my Computer using a MIDI Keyboard


For source code, check out this project’s GitHub page: https://github.com/SSODelta/keyboard-control

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.

Keys:

  • 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.

Advertisements

5 thoughts on “Controlling my Computer using a MIDI Keyboard

    1. I LOVE this idea and I’m very surprised – especially as there are far more than midi keyboards now – like audio interfaces and motorized faders – I found this while looking for a way to just control the volume on my macbook with the faders on my keyboard.

Comment on this article

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

w

Connecting to %s