TERM 2 projects


ChromaticKeyboard4 (Jan 2003)

Compatibility: This was compiled using Java 1.4.1. It doesn't seem to run on IE6, even with the latest Sun JVM download. But it's fine on my IE5.5. And Netscape 7.01 seems happy enough too on my Win98 SP2 system.

I've been working independently on another MIDI project while our new lecturer consolidates our understanding. Here are a few demo examples. You should be able to play sound by clicking the keys or using the qwerty keyboard. (Anything involving midi seems to need the Sun JVM.)

Launch organ demo applet source code
Launch piano demo applet source code
Launch xylophone demo applet source code
Launch glockenspiel demo applet source code

These examples all call instances of the same classes:

The ChromaticKeyboard class offers a flexible way of drawing a variety of chromatic keyboard layouts (including presets for piano, glockenspiel, xylophone, etc.) and making them playable with the mouse or by pressing qwerty keys. The space bar acts as a sustaining pedal. There are methods for setting sizes, labels, colours, range, timbre, individual note visibility, etc. The keyboard assembles a collection of individual keys defined in the ChromaticKey class.

ChromaticKeyboard source code

ChromaticKey source code

The ChromaticKeyboard class fires its own custom events as it is played, which are listened for by a GreatStavePanel class. This notates the pitches using standard music notation and includes a methods to set whether notes are displayed as sharps, flats or naturals, colours, etc.

GeatStavePanel source code

back to index


'Tic-Tac-Toe' or 'Noughts & Crosses' (Jan 2003)

Compatibility: This was compiled using Java 1.4.1. It doesn't seem to run on IE6, even with the latest Sun JVM download. But it's fine on my IE5.5. And Netscape 7.01 seems happy enough too on my Win98 SP2 system.

Launch Tic-Tac-Toe applet source code

This quickie only works with the latest Sun JVM, but I don't know why. Steve Wren emailed me his command-line version of Tic-Tac-Toe. I still have trouble programming non-Applet stuff, so here's my own applet version of the game. Programming-wise, I used this opportunity to explore inner classes and an anonymous MouseAdapter class. Thanks to Steve for info about how these work.

back to index


Mouse Pad 2D (Jan 2003)

Compatibility: This was compiled using Java 1.4.1. It doesn't seem to run on IE6, even with the latest Sun JVM download. But it's fine on my IE5.5. And Netscape 7.01 seems happy enough too on my Win98 SP2 system.

Launch MousePad2D test applet source code

This week I purchased a java package called JSyn, which allows you to achieve software synthesis through Java. This is right up my street and I've already hatched a plan to put a working basic synthesizer on my education website for upper primary school children to use. As a first step I've done this 2-dimensional mouse pad GUI component so that kids will be able to change 2 related parameters at once by clicking/dragging in the pad area. And the sliders allow parameters to be controlled one at a time. This demo is for an LFO but there are methods to set different labels. There's no sound yet of course - just GUI functionality.

Programming-wise, I used internal classes and anonymous listeners that keep the whole thing neatly inside one source file. Settings are displayed as percentages (more obvious for kids) but I've provided methods so I can pass X and Y coefficients as float values between 0 and 1 (better for JSyn).

back to index


XYControllerGroup (Feb 2003)

Compatibility: This was compiled using Java 1.3.1, so it's relatively safe. But you'll still need to install the JSyn plugin before this applet will work, which seems like a good idea because:

  • It's totally free.
  • It opens up the possibility for Java-based sound synthesis on your computer.

Launch test applet source code for the applet
source code for XYControllerGroup
source code for MWInsetPanel

This is a similar idea to the previous Mouse Pad 2D project except that:

  1. Its a better name!
  2. I made use of some of the classes that came as part of the JSyn software synthesis package. (I 'extended' them, in java-speak)
  3. Hopefully, it will work on most browsers and the Microsoft VM, (providing the JSyn plugin is installed).
  4. It looks better, it's more economical, and I think the code is structured more logically.

The knobs come directly from the JSyn package. The XY pad area is significantly extended from the JSyn package, with added crosshairs and memories and their associated variables and methods. It's treated as an inner class of the whole controller group. I also devised a separate class of my own to make it easier to put insets and borders round Java 1.3.1 components.

Of course, it makes no sound at the moment. The next step will be to tie it in with software sound synthesis and maybe include 2 or 3 of these panels to control different aspects of the synthesis process.

back to index


Vibrato 1 (Feb 2003)

Compatibility: Sun JVM needed, JSyn plugin essential.

Launch applet source code for applet
source code for 2-operator FM circuit

This one should make some sound! It's a simple FM oscillator configuration, with one LFO sine oscillator modulating another sine oscillator carrier. I subclassed this into a circuit with the 4 important variable input ports. Each of these 4 ports is controlled externally by separate knobs. The knobs are labelled with real-world 'music' words so you don't need to know all this synthesis jargon to explore it.

back to index


Vibrato 2 (Feb 2003)

Compatibility: Sun JVM needed, JSyn plugin essential.

Launch test applet source code for applet

This one does essentially the same thing as the last one, except that I've used two of my XYcontroller surfaces instead of four separate knobs. This allows you to 'perform' changes on 2 parameters at once and memorise 2 settings for instant recall. I keep tweaking earlier code as I go along, but I haven't bothered offering the source code unless it's something significantly new.

back to index


XY5 (Feb 2003)

Compatibility: OK with Microsoft VM, but JSyn plugin essential.

Launch test applet Page includes brief operating guidance.

Hey, this is getting somewhere. Both oscillators now offer a choice of waveforms and, for the LFO, I coded the wavetable data myself. The right panel now has a linear lag of 50 msec to smooth pitch changes. I tweaked the code to work with the Microsoft VM. This applet is maybe already usable in primary music education, where 'using ICT to change and manipulate sound' is an intended learning outcome of QCA Unit 18 - Journey Into Space.

back to index


Package Javadocs (March 2003)

Compatibility: Should be fine - it's just plain HTML

Click here to launch the index page of my API in its current state.

I've spent quite a while this month devising my own music-related classes and organising them into a package structure. I've also added javadoc compatible comments to everything. I've now caught up with myself and hope I can spend some time building on/with them over the next few weeks.

back to index


3 Midi Keyboard applets (April 2003)

Compatibility: These use Swing, so they won't work with th MS JVM.

Launch Midi Mouse applet Pages include brief operating guidance.
Launch Qwerty Player applet
Launch Major Keys applet

These are the first applets that make use of those music-related classes I've been working on. They let you play your system's default Midi synth (select it in the Windows control panel) with the mouse, or from the computer keyboard. The third one touches on some music theory.

back to index


Envelope Matcher (April 2003)

Compatibility: Should work OK with MS JVM. JSyn plugin essential.

Launch Envelope Matcher Page includes brief operating guidance.

This is another applet with a view to music education. User can play six different sounds on the keyboard. Each sound uses a different amplitude envelope. There are six envelope shapes. User must match each sound to the correct envelope shape. Button at the bottom can be used at any time to report which sounds do not yet have the correct match.

back to index