Music Creation
Introduction
Welcome
Since version 0.50.7, IVAN has included a MIDI sequencing engine. This MIDI engine adds dynamic music to the IVAN game. This page does assume that you have an understanding about MIDI and MIDI files. If you need more information about MIDI, check out MIDI.org
Tools
A digital audio workstation (DAW) is generally used to compose MIDI files. Trackers are also a viable option.
MIDI Engine Dynamics
The design behind the MIDI engine is to aid immersion for the player, however the music is changed dynamically to suit the environment the player is experiencing.
MIDI Tracks for Playback
Each area data file eg. GloomyCaves.dat, will have an entry in the Level descriptor section.
AudioPlayList = { 1, "Dungeon.mid"; }
This shows that there is 1 MIDI file associated with this area and that the file to be played when in this area is Dungeon.mid. More tracks can be associated with the level and these can be appended to the list with the corresponding file count adjusted to suit.
The tracks are played back in a randomly selected order.
Intensity Parameter
The MIDI sequencing engine has one parameter, Intensity, from the game logic which is passed to the MIDI engine. This intensity can in turn be based off multiple game parameters, such as number of monsters in vicinity, player HP, items player is carrying etc.
Currently, intensity is linked to the percentage of HP of the player. The lower the player's HP, the higher the intensity.
To ease compatibility with MIDI, intensity is a value between 0 and 127 inclusive.
When intensity changes, there is a
MIDI Track Allocation
There are 16 MIDI channels in a Standard MIDI file.
As intensity increases, the channel volume (CC7) is adjusted accordingly.
/** For each increase in intensity, the respective MIDI channel changes by the following amount */ int audio::DeltaVolumePerIntensity[MAX_MIDI_CHANNELS] = {0, 0, 0, 0, 0, -1, -1, -1, -1, 0, -1, 1, 1, 1, 1, 1};
This excerpt, taken from audio.cpp shows that:
MIDI Channels 1 to 5 inclusive do not change as intensity changes. These tracks are useful for bass, percussion or instruments that will be present irrespective of intensity level.
MIDI Channels 6 - 9 and 11 decrease linearly with intensity. These tracks are at their loudest when intensity is the lowest, useful for periods of low intensity or calm moments.
MIDI Channels 12 - 16 inclusive increase linearly with intensity. These tracks are at their loudest when intenisty is the highest, such as when the player is critically injured
MIDI Channel 10 is the percussion channel which does not change with intensity.
MIDI Track Design
It is up to the composer to decide on which musical theme the track should take. Tracks should be loopable, without abrupt changes when transitioning back to the start of the track.
Expression or CC11 should be used to control the track dynamics not Volume/CC7 as it will be overridden by the MIDI engine. Channels should always initialise all Program Change (PC) and CC's to ensure it is not affected by the last played track.
Bear in mind the MIDI device that you are using to render the files. Most Windows users will be using the no frills Microsoft Wavetable GS Synthesizer. This is GM1 and not GM2 compatible so the composer should keep this in consideration when using GM2 extensions. GM2 extensions can be used in anticipation that the MIDI engine will incorporate a GM2 compatible soundfont/synthesizer.
Most of all, have fun writing music for this game.
Future Development
Dynamic Algorithm
The current dynamic volume changes are linearly and there are 5 tracks for each, static, decrease and increase per intensity change. More complicated tracks could change this allocation.
Intensity Parameters
Intensity is currently only linked to the HP% of the lowest body part. This could be expanded to level/dungeon sections. Items equipped, monster vicinity, danger level etc.
Soundfonts
The MIDI engine works off the hosts MIDI devices, this means that the MIDI files are rendered on the host's MIDI device and may not necessarily sound the same as the composers. A future development could embed a soundfont to enable a consistent experience.