This page covers music related patches. As such, it relates mostly to Keen Galaxy. At present, about the only patches available are those that will change what song plays in a level.
There is a patch and program created by User:Lemm to allow IMF files of up to 32 KB in Keen Vorticons.
Keen Vorticons music
The TSR TSMusic created by User:Lemm allows a modder to include as many IMF music files as they wish, one per level. To be used TSMusic requires the Keen engine to coomunicate with it, and thus a patch. The patches for Keen 1–3 (v1.31) are as follows:
|Patch: Keen 1|
|Patch: Keen 2|
|Patch: Keen 3|
Keen Galaxy Level songs
These patches change what song is played in a given level. You are limited only to songs in the AUDIO.CKx file. For other music, the values used are not the song number, but the level number that plays the song you want, with some complications. (It is best to experiment with these later values, to see how things work.)
Additional songs can be added to the game by using a chunk designated for sound to hold an extra songs. In the executable, the audio chunk pointers are ordered so that the music chunk pointers are immediately after the sound chunk pointers. Thus, if you shift the boundary between sound and music backwards, you create more space for music chunk pointers at the expense of sound chunk pointers. This also shifts the existing song numbers correspondingly (e.g. if you shift by two chunks, a song that was originally song 3 becomes song 5, since the first music chunk is now two chunks earlier). To use the extra songs patch, lower the existing start index of the song chunks by however many new songs you are adding. Then lower the corresponding start of audio segment pointer by 2x however many songs you imported. For example, in keen 5, if you were to add two songs, %patch $8C61 $00C0W would be lowered to $00BE, and %patch $8BF1 $BF45W would be lowered to $BF41W (along with the two subsequent patches). Finally, you would have to change the total number of songs from 14 to 16.
|Patch: Keen 4|
|Patch: Keen 5|
|Patch: Keen 6|
Music and extra levels
It is possible to have extra levels in Keen Vorticons and Galaxy. For Vorticons there is no issue, the TSR program will provide music for any level. With Keen Galaxy the music list must be extended, this is done by simply adding new entries to the end of it. (This will overwrite some of the Patch:F10 M Cheat text.) The extra level patch also has an entry for the number of level song entries in the list. This should match the number of levels.
Create a secondary song list
This patch creates a secondary music subroutine that uses an alternate song list/ What this means is that when used it will play the song from this list instead of the main level list. This is useful if music\level space is tight, or the modder wishes to play a song that does not appear in any possible level. It relies on using the EGAGRAPH check skip and so is incompatible with any other patches that use this.
Following the main part of the patch is a series of optional patches that make various situations in the game use this alternate song list. Any or all of them can be used or removed as desired. Note that the song to be played in these uses is highlighted in blue.
|Patch: New song list|
|Patch: Optional uses of new Keen 4 song list|
Insufficient Memory to play music error
This error occurs when after all the level and graphics have been loaded, there does not remain enough free memory to load the IMF music file selected for that level. The solution is to either use a smaller music file for the level or free up memory.
This error is both easy to diagnose and remedy. The first step is to load the level with the error. Using the memory test cheat (F10 + M) the amount of free memory without the music can be found. This can then be compared with the size of the IMF file needing to be played to give a good estimate of how much extra memory needs to be freed up. If a smaller music file is not desirable or cannot be found then more memory will have to be freed up. This can be constantly checked with the memory cheat.
There are three main ways to free up memory. The first is to physically shrink the level's size; each tile removed will free up six bytes of memory, so trimming a large level can save a lot. This however is often not preferable.
The second method is to lessen the number of different tiles in the level (This is why TED5 has a function to tell you how many there are.) each background tile will save 128 bytes and each foreground tile 140 bytes of memory. Again this may not be preferable, but a large level often contains many tiles that do not really add anything to it.
Finally certain sprites may be removed. Each sprite caches all its graphics into memory so it can display them A sprite can easily take up tens of kilobytes of space, the larger and showier it is, the more memory it needs. To remove a sprite cache, all instances of the sprite must be removed from the level, not one can remain.
A related solution is to edit the graphics, either making them smaller, or changing how many copies are placed into memory. (In theory this will make the sprite move less smoothy, but this is often hard to see.) This can halve or even quarter the amount of memory the sprite needs to run.
Other errors can be found at Patch:Game errors.
|Patch: Insufficient memory to play music|
Don't play music
These patches remove music from playing or changing in given situations. For disabling music in a level the best option is to create an 'empty' song with no sound and use that as the level music.
|Patch: Keen 5|
Play a certain song while an item is got
This patch causes a certain level's song to be played in any normal level while some condition is met. Here the map (level 0's) music is played while Keen has the V card. Loading a saved game or going to the help\menu will result in the 'default' music restarting. By changing the $0000W a different level's music can be selected.
|Patch: Keen 5|