Here's a virtual version of my physical tone matrix, implemented in Flash, so you can play along at home:
Much of the code is a direct translation from the C code in the non-virtual version, so it works in a way very close to the real thing. Even the sample rate and frame rate are close (though they are not synchronized - it's not a cycle-exact simulation).
Click or drag on the screen to turn the lights on and off.
The knobs are (from top left) sustain, tempo, tuning and volume. Above and between the sustain and tempo knobs is the escape switch, which brings up or closes a menu of funcions. These are, from top left:
- Sine wave (default)
- Square wave
- Triangle wave
- Sawtooth wave
- Random wave
- Pattern editor (default)
- Coarse waveform editor
- Fine waveform editor (not particularly useful or easy to use)
- Tuning editor
- Miscellaneous editor
- Save current pattern/waveform/tuning/settings to EEPROM
- Load current pattern/waveform/tuning/settings from EEPROM
- Toggle life mode
- Toggle random mode
- Toggle microtone keyboard mode
The miscellaneous editor shows 6 rectangles. Clockwise from top-right these are:
- Patterns per loop (a 5-bit binary number) - if this is not 1, then whenever the pattern reaches the right a new pattern is loaded from EEPROM.
- Fixed tuning - just disables the tuning knob. This exists in order to allow the tuning to be set more accurately on the non-virtual version, not really necessary on the virtual version
- Update noise continually - when set, the waveform is continually updated with random data, so all frequencies sound the same. This is slightly different to the "random wave" waveform preset, where the 256 waveform components are initialized with random numbers but then don't change, so there are some audible differences between playing them at different frequencies.
- Beats per pattern - repeat before the pattern gets all the way to the right, useful for rhythms that don't factor into 16.
- Sustain override - overrides the function of the sustain knob so that this parameter can be set digitally.
- Tempo override (a 16-bit binary number) - must be greater than 0x200 to work - smaller numbers are faster).
The EEPROM save/load functions load or save the data for the current editing mode (pattern, coarse waveform, fine waveform, tuning or miscellaneous). To use them, press save or load. The screen then shows the current EEPROM contents. Click on a location to choose where to save to or load from. Depending on the editing mode, 2-8 lights will be lit per "saved file".
Fun things to try:
- Put the PTM in random mode and light 10-16 lights. Then just sit back and listen to some randomly generated music for a while.
- Draw a glider or Lightweight spaceship, put the PTM in life mode and turn the tempo all the way up to maximum.
- Make a horizontal line in pattern editor mode, turn the sustain all the way up so that the sound is continuous, then switch to the coarse waveform editor (which was inspired by this). Click and drag around to move the "sliders" and see what sounds you can make.
- Make sure the pattern editor is empty and then switch to microtone keyboard mode. The lit lights correspond to the white notes on a piano keyboard - the unlit lights are the frequencies in-between (i.e. it's a 34-TET instrument). Try to play or tune or make some weird music. Trying the different preset waveforms is fun in this mode.
- (Advanced) Try to create a different tuning such as major scale or chromatic (instead of the default pentatonic) using the tuning editor. Each line of the tuning editor represents a frequency as a 16-bit binary number (LSB on the left), in units of roughly 0.24Hz (16Mhz / 226).
- (Advanced) Make some patterns and save them in consecutive locations in EEPROM, starting at the top left. Then use the "patterns per loop" setting in the miscellaneous editor to play them back in sequence and make a tune longer than 16 notes.
The copy and paste functions on the right-click menu work and are compatible with the original Tone Matrix applet.
Source code is here.