www.GilesDarling.me.uk

Microtonal MIDI Keyboard Program

Microtonal MIDI Keyboard Program screen capture

Introduction

I recently wrote a program to enable me to play microtonal music using an ordinary, standard 12-keys per octave MIDI keyboard. On this webpage you can download the program for free and also see how to create your own microtonal scales

Microtonal scales (also known as equal-temperament scales (or TET) or 'equal division of the octave' (EDO) scales) are scales with a different number of notes per octave (e.g. 5, 7, 19 or 24 instead of the standard 12 notes per octave) and therefore the interval between notes is different, and you can create different tuning effects. The program includes three sets of 19-TET scales as well as 5-TET, 7-TET and 24-TET scales

Download / Install / Uninstall

You can download the program MicrotonalMidiKeyboard.exe here (44 kilobytes)

The program was written using MS Visual Studio 2005 and it works OK on Windows XP and Windows Vista (and therefore presumably on later versions of Windows). It's a stand-alone EXE file which you can store where you prefer (for example in your Users folder)

The program allows the user to store program data settings in the Windows Registry. If you want to uninstall the program and there's data in the Windows Registry, you can remove this data from the Windows Registry by selecting 'Admin' in the program's menu bar and then selecting 'Remove from Registry' ('Admin' will be greyed out if there's no data stored in the Windows Registry). To uninstall the program, simply delete the EXE file

I scanned the program for viruses (it came up all clear) before putting it on my website. But I would strongly advise that you scan the EXE file using your computer's anti-virus software before you run the program for the first time

The program is freeware and I offer no support for the program, although I welcome comments (see the link at the bottom of this page) particularly if it appears I've made a mistake in the code

Source Code

You can download a zip file of the program's source code here (21 kilobytes). This ZIP file contains 3 files: the .CPP code file, .RC resource file and .H help file. I haven't included the icon file, as the icon isn't very inspiring

The program is written in simple C++ (i.e. no object-orientated programming). The code could no doubt be improved, but my priority was to write a short and simple program that worked, rather than writing 'perfect' code. Winmain is at the bottom of the code, with child functions written above it. By doing this I can avoid having to declare any functions at the top of the source code. I've included comments throughout the code to show what's going on where

The MIDI bit

The program uses MIDI pitch bend messages (0xE0 to 0xEF) to fine tune the notes played. Because pitch bend affects all notes on a channel, the program uses all MIDI channels (except the percussion channel) to enable notes with different pitch bend values to play simultaneously

The program uses program change messages (0xC0 to 0xCF) with control function 0x40 to start and stop the sustain pedal

How to use the program

When you start the program, if there are any program settings data in the Windows Registry (not the case when you run the program for the first time) the program will ask if you want to re-use this settings data

By default, when the program starts, no MIDI input or output devices are selected. So, if you want to play some notes you'll need to select at least a MIDI output device via 'MIDI' in the program's menu bar and then 'Output' to see which devices are available

You can also change which instrument is played, the MIDI output volume, and even the note order (reverse it so that high notes are to the left, low notes to the right) via 'MIDI' in the menu bar

Select 'Tuning' in the 'MIDI' menu bar option to choose a different microtonal scale. By default the program comes with 7 predefined scales and 3 user-defined or 'custom' scales. In fact you can rename and edit any of these tuning scales by selecting the 'Edit' option at the top of the list. This will display the 'Set Tuning Parameters' dialog box. In the 'Set Tuning Parameters' dialog box you can choose whether your scale spans 1 or 2 octaves, and enter data such as semitone shift, fine tuning via pitch bend values, and whether a particular key plays a note

Click here to download a PDF which shows how to calculate pitch bend values for different microtonal scales

Don't worry if you don't have a MIDI input device connected to your computer. You can click the mouse's left button over a key in the program's window to play that note. Dragging the mouse across multiple keys in the program's window plays multiple notes. The 'shift' key on your computer keyboard also acts as a sustain pedal

If a note or notes keep on playing when they shouldn't, you can select 'Reset' in the 'Output' submenu of the 'MIDI' menu bar option to send a Reset message to your MIDI output device

When you close the program (typically via 'Exit' in the 'File' menu bar option) the program asks you if you want to store the program's settings data in the Windows Registry. This can be useful if you've made changes to the tuning scales that you want to keep. There's no 'export' data option in this program

Other thoughts

You could consider creating 'pure intonation' or 'just intonation' scales which use ratios with small whole numbers to create a scale that has better tuning, although only in particular keys. I tried to do this, but I couldn't get it to work, which is why there are no predefined pure intonation scales in this program

Windows usually comes with a standard software based MIDI output device, but it suffers from latency - i.e. when you play or click on a key, there's a short pause before the note is played. There's nothing this program can do about that. If the latency issue drives you mad, the best solution is to attach a MIDI output device (such as a MIDI keyboard or a MIDI sequencer like the Edirol SD-20 that I use) to your computer. These hardware devices typically suffer minimal (or almost no) latency. So you get instant playback which is very satisfying


I hope you find the program useful and enjoy experimenting with non-standard scales. If you have any comments please contact me via the link at the bottom of this page


Contact Me    Home Page This page was last updated on 1st March 2015