QuasiMusic turns quasiperiodic tilings of the plane into something like a MIDI version of a player-piano roll. This was inspired by a suggestion made by Akira Bergman in a discussion with John Baez. If you want to hear an example of how this can sound, just load one of the demos and hit the PLAY button. John Baez has created some wonderful ambient music that uses the output of this program as a starting point; his tracks are available here.
Unfortunately, not all installations of Java come with the necessary soundbank file (which defines a set of MIDI instruments for the Java MIDI system to use). If you get an error message from the applet saying that there is no soundbank, you can download one from the Java web site and install it by following the instructions on that page. (For example, if you're running Windows and you have the Java runtime version 6 installed, you will need to place the soundbank file in the directory C:\Program Files\Java\jre6\lib\audio\.) Alternatively, if Java version 7 is available for your operating system (you can check here), the standard installation does not need anything extra downloaded.
Two important warnings before I go into some more details about the applet's operation. First, you can only load and save files if you download the application version of this applet, by right-clicking on this link to QuasiMusic.jar. To run the application, you can place the file QuasiMusic.jar in whatever directory you like. It might run directly from the desktop if you double-click its icon (this will depend on your particular operating system), but if that doesn't work go to your system's command line console, make the directory in which you put QuasiMusic.jar your current directory, and type:
java -jar QuasiMusic.jar
But if you just want to play the demos, or try out some ideas of your own without being able to save your work to disk, you can do that with the web version right here on this page.
Warning number two. The Java MIDI system can be a bit erratic at times. It will occasionally fall silent for no reason, or sustain notes endlessly. If this applet goes either mute or berserk, the only surefire cure is to quit it and restart. You can sometimes fix the problem by starting and stopping PLAY a few times, but that doesn't always work.
Also, support for instruments above the first 128 standard General MIDI instruments appears to be very erratic. If any of these extra instruments are available, their names are shown in coloured text: green for bank 1, red for bank 2, and blue for banks 3 or higher. [A “bank” is a numbered collection of up to 128 instruments, with bank 0 referring to the standard set that every synthesiser is supposed to implement.] As of mid-2012, my own experience using a Mac and the soundbank file that comes with the standard Java 6 installation is that none of the bank 2 instruments make any sound at all, and the bank 3 instruments, though given various exotic titles, really just repeat the bank 0 instruments! So all I can suggest is that you try things out and see what works for your own setup, but don't be surprised if whole banks are silent or make sounds that have no connection with their titles.
Imagine a series of up to 16 vertical lines running down the tiling panel. Each time one of these lines crosses into a new tile, it triggers the sound associated with that tile (which can be chosen differently for each of the vertical lines, or “channels”). When you play a tiling, the little white rectangles that appear (which are meant to be reminiscent of the holes in a player-piano roll) mark these cues.
When you choose an n-dimensional lattice, there are different tiles for every pair of dimensions, for a total of n(n–1)/2. For example, for the 7-dimensional lattice that we call Z7 there are 7 × 6 / 2 = 21 different tiles. Some of these will have the same shape as each other, but they are still distinguished by their orientation. (You can read more about the geometry of the lattices and tilings in these notes on the deBruijn applet.) For each channel, sounds can be associated with as few or as many of the tiles as you like.
PLAY always resumes playing from the current point in the tiling visible on screen. REWIND will take you back to a notional starting point in the tiling. The RANDOMISE button gives you a new geometry for the whole tiling each time you hit it, but if you hold down the SHIFT key, SHIFT-RANDOMISE will step back through the same sequence of possibilities.
If the SOLO option is checked, only the current channel is played.
When you hit one of the LOAD DEMO buttons, sounds are associated with all the tiles of the current lattice, for a set of channels that differs from demo to demo (some use just one channel, some use all sixteen). The demos use a particular, fixed instrument for each channel, and then associate various notes with the tiles. (It's not necessary to work that way, though — it's possible to use a variety of instruments on each channel if you wish.)
If you change the lattice to a higher-dimensional one after loading a demo, you will see that some tiles turn white. That's because new pairs of dimensions have appeared for which no notes have been assigned. You can still play the tiling; it will simply have a sparser set of cues.
You can also make the lattice larger or smaller, with the LATTICE SIZE gadget. A larger lattice will play at a slower tempo, because the cues will be farther apart.
Starting from either a blank slate or a demo, you can choose your own sounds to associate with the tiles.
First, use the CHANNEL gadget to pick a channel to work on. While the tiling isn't playing, all tiles without a sound associated with them for this particular channel appear white. When the tiling is playing, it doesn't matter what the current channel is: each tile that has a sound associated with it on any of the channels will be drawn in colour.
To hear the sound associated with a coloured tile, just click it. It will brighten while it's playing.
To associate a new sound with a tile, SHIFT-click it. It will turn yellow. Then choose an instrument from the instruments list, and play something by clicking a key (or a sequence of keys) on the piano keyboard. You can also control various attributes of the notes you play with the sliders below the piano. When you're finished, SHIFT-click the tile again, and it will change to its usual colour. You can then hear the sound you've stored for this tile/channel combination by clicking on it. There's no need to rush to play the first note after SHIFT-clicking a tile: any silence until you play the first note is cut out. But if you play one note, wait five seconds, and then play another, that timing will be reproduced when the tile is triggered.
If you like, you can tell the applet that you're finished defining the sound for a tile by SHIFT-clicking on a different tile that you want to work on next, saving you the step of explicitly closing the previous tile.
To remove the sound associated with a tile, just SHIFT-click it twice in succession: that is, open it, play nothing, then close it again.
(NB: MIDI uses channel 10 differently from the other channels. Instead of different keys giving different pitches, they make different percussive sounds. These sounds depend only on the “note” you choose, and the selected “instrument” is ignored.)
What if you want to play a chord rather than a single note, when you're associating a sound with a tile? The way to do this is to make use of the CHORD KEYS to the right of the piano. Before choosing a tile, you can SHIFT-click one of the chord keys – it will turn yellow, to show that it's currently selected – and then strike a succession of ordinary keys on the piano to add them to the chord. Hitting any piano key a second time removes it from the chord. When you're done, SHIFT-click the chord key again, and then any ordinary clicks on that key will play the chord you've defined.
Note that once you've used a chord key to give a sound to a tile, if you later redefine that chord it won't change the sound of the tile; the individual notes for the chord at the time it's played are stored for the tile.
You can use the IMPORT MIDI button to give a sound to a tile, after SHIFT-clicking the tile to select it. The applet will show you a list of the music found in the MIDI file; you can choose to import the sound from just one of the file's channels, or all of them. This is likely to work best with fairly short pieces.
Hit the CLEAR THIS CHANNEL button to erase all the notes associated with the current channel, or the CLEAR ALL button to clear them all.
Hitting the COPY CHANNEL NOTES button will place in the clipboard a copy of all the notes assigned to the tiles for the currently selected channel. If you then select a different channel and hit the PASTE CHANNEL NOTES button, the newly selected channel will now have all those notes.
To force all the notes for the current channel to be played on a particular instrument, select that instrument from the list and then hit the IMPOSE INSTRUMENT button.
One easy way to make new tile notes is to start with one of the demos, and then use this to change the instruments. You can also extend the channels in a demo using copy and paste, or prune away unwanted channels with clear.
If you're using the application version of QuasiMusic, you can save all the associations between tiles and notes in a file, which you can later reload and play or edit further. Click the SAVE AS button to choose the file to save in; the SAVE button will store your tile notes again in the same file.
If you're using the application version, hitting the RECORD MIDI button works much like the PLAY button, except that everything played is accumulated, and when you stop you can save the whole “performance” to a MIDI file. Note that when you play back this file with another program, it might not sound identical to the instruments you heard from the applet; that will depend on the particular MIDI system you're using to play the file. QuasiMusic itself can play back its own MIDI files, so that will guarantee that you hear them with the original Java soundbank instruments.
If the SOLO option is checked, only the current channel is recorded.
Parts of this applet are adapted from the MidiSynth.java module of the JavaSound demo, by Brian Lichtenwalter. The licence is reproduced below, as required by the terms of reuse of the code. The original demo can be downloaded from the Java web site.
/* * @(#)MidiSynth.java 1.15 99/12/03 * * Copyright (c) 1999 Sun Microsystems, Inc. All Rights Reserved. * * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use, * modify and redistribute this software in source and binary code form, * provided that i) this copyright notice and license appear on all copies of * the software; and ii) Licensee does not utilize the software in a manner * which is disparaging to Sun. * * This software is provided "AS IS," without a warranty of any kind. ALL * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * * This software is not designed or intended for use in on-line control of * aircraft, air traffic, aircraft navigation or aircraft communications; or in * the design, construction, operation or maintenance of any nuclear * facility. Licensee represents and warrants that it will not use or * redistribute the Software for such purposes. */