Sound #1- Defining the music format and driver outline
Hello world,
Melissa and me started working on the sound system. Before the project started, I had a rough idea of a format we might be able to use to gain space without much worry over performance and difficulty to generate.
Today, we worked out the last kinks and ridges and defined the format precisely. We also outlined the driver’s structure and behaviour. Basically, a file will have N channels, each with their own scale and timings, The scale and timings will be described by a table associating a frequency/duration to a 4 bit index.
Each note will then be entirely described by a single byte.
The driver will then only have to keep in memory which note it is playing on each channel and when it has to go to the next note. To play a note, the driver has to read the byte of the note, read the descriptors to get the frequency, place it the the register corresponding to the channel, and set itself up to follow the timings.
We decided to use the timer interrupt to drive the timings, and, as the channels might not change notes at the same time, we make the timer fire the interrupt every 1/4096 s, and we manually keep track of when we have to change notes.
Silences are handled by a flag in the scale descriptor.
While Melissa is working on the implementation of the driver, I’m working on a converter from MIDI to this format in order to take already written music, and put them in the game.
Stay tuned for more !
Dorian