The MegaPak orchestra consist of 5 instruments.
2puck.zip
The Lynx has 4 channels that it can play at the same time. For some tunes like the Mozart Sonata I have one channel for the right hand and one for the left. Both hands play the Piano-instrument, of course.
Some other tunes have Drums, Saxophone, Trumpet and Bass.
For the MegaPak I converted several Midi-tunes to a format called ABCmusic. The simplest tune Suzuki Guitar on the MegaPak cart looks like this in ABC-format:
#define STR_BASS "I2" #define TEMPO "T20" char suzuki[] = { STR_BASS TEMPO "|2:CDEEDEFFEFGEFDGGCDEEDEFFEFGEFDCC" "cBAABAGGAGFFEDEEcBAABAGGAGFFEDCC" "ECDDFDEEGEFGABccECDDFDEEGEFGABcc" "CDEEDEFFEFGEFDGGCDEEDEFFEFGEFDCC:" };
These tunes use the instruments the Soundtool controls.
2puck.zip
This means that you can listen to the music and change the Piano to sound like a xylophone or a flute using the Soundtool.
There are two sections in the Soundtool. The first is the sound engine. You can press Opt2 to start a tune and flip through different waveforms by pressing joypad Left/Right. Then just use your ears to see which sound is best.
2puck.zip
The Pitch is the height of a tone.
The Waveform is a sound generated by the Lynx. There are 6185 different waveforms available. The Lynx hardware cannot produce more waveforms than 6185.
Integrate can be on or off. If it is off then the Lynx produces a square wave - only 1's and 0'1. But if integrate is on then it calculates a smooth waveform. If the bit to output is a 1 it adds Amplitude to the output. If it is 0 it subtracts Amplitude from the signal. So to make sense the Amplitude needs to be small. Otherwise the sound will clip and sound distorted.
The text Symmetric waveform means that in this particular waveform there is an equal number of 1's and 0's. So the sound will not drift to the maximum and start popping.
The funny looking numbers in green are what values you need to program into the Lynx registers to get this sound.
FD20 40 - amplitude
FD21 1F
FD22 3F - DAC output (this is what really gets to the speaker. It changes all the time.)
FD23 2C
FD24 8D - pitch
FD25 00
FD26 6E - count register (it also changes by itself all the time)
FD27 B2
After this programming the Lynx will sound like this forever without any need for the CPU to do anything about this. So if you are making a new Pong game or Elite clone you can try out the perfect sound for the engines, lasers, paddles or whatever using Soundtool.
Listening to a beep goes on your nerves in no time. So it is time to move on.
The second section is the Envelope.
The Attack speed tells you how many steps you increase the volume during every 13 ms. The Hold * 13 ms is the time you keep the volume steady before it dies out by Decay steps every 13 ms.
Changing of the volume is actively done by the CPU.
You can search for new and better sounds using the music on the cart and the Soundtool. If you find better instruments you can save the settings on the EEPROM and your new instruments get saved there even after you power off your Lynx.
- Read more...
- 1 comment
- 873 views