JULY 2018

Chapter 06 - Let there be music (Part 3)


Since the last chapter, I have been busy spending a lot of time with my Game Music Creator  program when it suddenly dawned on me that I may have contracted some illness or disease.  Consulting with Doctor Google, I found a diagnosis that explains my problem exactly. 


Creeping featurism or featuritis is the ongoing expansion or addition of new features in a product.

This is commonly referred to as Feature Creep.


My original goal was to whip up a quick tool that allowed me to compose the music for my game that played using my 4 voice music routine.

What started as a quick and dirty solution quickly became an obsession to make a commercial grade utility with all the bells and whistles (pun intended) that I was capable.

I was having so much fun creating the program and learning about music creation that I developed an addiction for making improvements to make it easier and more powerful. This was delaying the actual development of the main game and I knew I had to pull the pin and be satisfied with what I've done so far.

I have therefore decided that the program is finished and I can now move forward and begin composing that epic soundtrack for GunStar. This is a useful utility for creating music for inclusion in my games and I can always expand on it later for future game projects.


Game Music Composer - "Final"

Game Music Composer (GMC) is a totally software driven music composition and playback tool. It is written entirely in standard Super Extended Color Basic with an Assembly Language playback routine for the Color Computer 3.

Its purpose is to allow me to compose and create music for inclusion in my future games.  Because the music playback consumes a lot of the Color Computer's CPU time, simultaneous game play will not be possible while music is playing. GMC is no substitute for a dedicated sound chip but has the advantage that the music will be available on every Color Computer 3 without the added expense of extra hardware.

GMC plays 4 channels of sound with envelope processing available on each channel. GMC is not the only 4 channel software music playback routine made for the Color Computer. It is simply *my* playback routine that I will use in my games.

It's no Fairlight or Roland synthesizer but it will suffice for what I wish to achieve.


User Interface

The screenshot below is the current version of GMC for this project. I still have ideas of what could be added but this will suffice for this now. In time, I can add features and customize the UI even further as I use it more thoroughly.

I've learned a lot about music and have a greater appreciation for some of the commercial packages available on the CoCo and other platforms.



A quick overview of the screen is as follows...

Title Bar:  At the top, we have the Title Bar with the name of the program on the left. To the right is a VU display that graphically shows the amplitude of each of the 4 voices as the song is played. To the right of that are two single key functions.

Throughout the screen, you can see various letters and symbols within a Cyan colored 3D box. These are the single keys to activate that function.

   PLAY begins playing the entire song from start to end. My plan is to add the ability to play a single pattern in a future revision.

   MENU switches to a separate menu screen for options to Load/Save songs and other functions.

Piano Roll:  Where notes are entered and edited for each pattern. This area shows a musical keyboard at the left and musical notes (RED dots) are entered as a progression of time. Each pattern holds a screen width worth of notes (77 notes in total). The WHITE dot is your cursor or pointer which you move around.

The end of the song itself is highlighted by placing an end marker (YELLOW line). You can also place a go-to-next pattern marker (GREEN line).

Envelope Control:  The envelope of a note represents the varying level  of a sound over time and is broken down by GMC into 3 areas; Attack (sound level rising time), Sustain (sustained hold of the sound level) and Release (sound level falling time). This wave level shape is represented graphically in the window.

The Fixed option disables this A S R control and allows a 15 level fixed continuous level.

Tempo Control:  The overall speed of the song playback.

Note Value:  The actual music note value highlighted by the WHITE cursor position.

Beats-per-Bar:  A segment of time corresponding to a specific number of beats represented by the vertical blue lines in the Piano Roll editing area. The values represented are 2, 4 6 and 8.

Pattern Selector:  Any one of the 26 patterns (A-Z) may be selected here. The selected pattern is displayed in the Piano Roll area and the Envelope Control settings are applied to the entire selected pattern.

Pattern Sequencer:  This is where the patterns are laid out in sequence of play for each of the 4 sound channels. A pattern can be repeated and used multiple times within the overall sequence.


How it works

GMC is a totally software driven music composition and playback tool. It is written entirely in standard Super Extended Color Basic with an Assembly Language playback routine for the Color Computer 3.

It's purpose is to allow me to compose and create music for inclusion in my future games.  Because the music playback consumes a lot of the Color Computer's CPU time, simultaneous game play will not be possible while music is playing. GMC is no substitute for a dedicated sound chip but has the advantage that the music will be available on every Color Computer 3 without the added expense of extra hardware.

GMC plays 4 channels of sound with envelope processing available on each channel. GMC is not the only 4 channel software music playback routine made for the Color Computer. It is simply *my* playback routine that I will use in my games.

It's no Fairlight or Roland synthesizer but it will suffice for what I wish to achieve.

How it works

The core component of GMC is the Assembly Language music playback routine.

This comprises the music player which features a sequencer that fetches each note stored in memory and allocates them to the appropriate sound channels with envelope.

The other important component is the interrupt driven tone generator routine which acts as a sound chip, generating four square wave tones and mixes them together as one.

The diagram on the right shows a block diagram of the sound routine's function.

The four oscillator boxes (light red) represent the 4 individual square wave generators. These run continuously during playback at a selectable frequency and amplitude. This is run from an FIRQ interrupt  at a base frequency of 27534 Khz.

The outputs of each oscillator is fed to an envelope routine (light green boxes) which run outside of the FIRQ routine and synchronized with the Vertical Screen Refresh. Each channel is individually processed to create  the desired envelope.



Each envelope output is then mixed using additive synthesis to create the merged single monophonic output which is then fed to the DAC for output as the final sound that you hear.


Extra features

Noise - I have added an extra option to the 4th oscillator where I can choose between a square waveform and a noise waveform in order to allow a percussive sound, although it sounds more like a gunshot than a drum but that was all I could easily include into the tight timing restrictions. I would need to delve into actual samples to create something more drum realistic but that would require more memory.

My goal was to create a low memory playback routine for inclusion into my games.

The actual Assembly Language routines which includes the FIRQ interrupt routine and the song note/pattern sequencer occupy just over 1K RAM. If I take out a few extras which are not require within a game (such as VU display) the code is less.

I have allocated a single 8K MMU block for the music code plus the storing of the music composition itself. This is more than enough space to store a lengthy tune or several different tunes, depending on what I need in my game.

Chords and Harmonics - By allocating two channels to play the same notes but offset by a few notes, I can make the basic square waves sound more complex and interesting. GMC makes it easy to copy a range of notes and offset them by a user selected amount allowing for the creation of chords and harmonics.

I can also make some interesting sounds if I also choose different envelopes  for each simultaneous note.




Copyright 2017 by Nickolas Marentes