Azasel music engine
Posted: Mon Mar 16, 2009 7:15 am
Ok, here's the isolated music/sound engine based on the work with Air Zonk engine. The sample format has been changed to uncompressed version. Instead of RLE compression for size, the samples now have range compression. In Azasel, the channel volume is treated as internal (similar to TL on FM chips) for the volume envelope system. Channel volume by the musician instead is routed through pan volume. The samples take advantage of this by taking the upper 3bits of the 8bit sample and subtracting that from TL (0x1F) for range compression. This means older samples used by PCE games and such play fine as long as they don't have the top 3 bits set. Also, there's is no sample length - a termination value of 0x2E is used instead (unless cut short by the length argument).
Anyway, the engine itself is now separate module in which (hopefully) you can incorporate into your own code/design. For now, there is no mml ascii converter or tracker. All songs must be composed in a pseudo MML structure using data defines. It's not so bad actually. I've include 3 examples songs and equates to facilitate the process. I've included the channel waveforms from Air Zonk which are located in the .wf file. Air_Zonk_WF_view.pce is a waveform viewer so you can see what the waveforms look like. I've only included up to 38 different waveforms. There's also a document describing the functions of this engine - Az_mml.txt. The document is meant for an up and coming MML ascii converter, but you can still use the information about the functions and FX (envelopes, vibrato, portamento,etc). MML.equ holds the additional info you'll need.
I've included a batch file and PCEAS just in case.
azasel.asm - the sound/music engine
mml.asm - and interface to Azasel engine. Provided gamepad support and onscreen display. Also contains the song file includes.
Things to note about the data define format:
".loop" = using a "." tells the assembler that it's a local label. Local labels exist inbetween regular labels. With local labels, you can re-use the label one.
"label:" = a regular label is defined with a ":". You can use these if you want, but you can't re-use the name once you declared it.
".db" = define byte. It defines a byte in a series/string of data. Use the "," to separate bytes. Some commands are WORD size, they must be stored as LSB,MSB format
"low()/high()" = low(some label or value) returns the LSB of a WORD data types. High returns the MSB. You only need this for jump style commands and loading a waveform.
"$" = if you want to use a hex number instead of a decimal number, prefix the value with a "$". You probably want to do this for negative numbers, especially WORD sized negative numbers.
The names of functions in the song examples are equates. They equate to a value. You can add/subtract/multiply/divide/use logic operations, etc on any value or function. The only function that you need to modify though, is the "rest" function. You add the rest period value to the function itself (it's an embedded operand in the command).
Also, PCEAS doesn't seem to like long lines of equates. I've broken my examples up into lines of less than 94 characters long. You'll get a syntax error on that line of it's too long. You don't need to end a line with a ",". I think that about covers it.
Oh, one more thing. Notes. PCEAS doesn't like "#" in the equate system, so all sharps use an "x". A normal note is "C2." and a sharp is "C2x". The middle number signifies the octave.
Oh, one more more thing. A command string ends with either: a "note" or a "rest" function. If you jump in a loop that has neither, the engine will lock in an infinite loop and freeze playback.
Edit: new url
Ver 1.0 - alexandria66.2mhost.com/~pcengine/music/Azasel.zip
.
Anyway, the engine itself is now separate module in which (hopefully) you can incorporate into your own code/design. For now, there is no mml ascii converter or tracker. All songs must be composed in a pseudo MML structure using data defines. It's not so bad actually. I've include 3 examples songs and equates to facilitate the process. I've included the channel waveforms from Air Zonk which are located in the .wf file. Air_Zonk_WF_view.pce is a waveform viewer so you can see what the waveforms look like. I've only included up to 38 different waveforms. There's also a document describing the functions of this engine - Az_mml.txt. The document is meant for an up and coming MML ascii converter, but you can still use the information about the functions and FX (envelopes, vibrato, portamento,etc). MML.equ holds the additional info you'll need.
I've included a batch file and PCEAS just in case.
azasel.asm - the sound/music engine
mml.asm - and interface to Azasel engine. Provided gamepad support and onscreen display. Also contains the song file includes.
Things to note about the data define format:
".loop" = using a "." tells the assembler that it's a local label. Local labels exist inbetween regular labels. With local labels, you can re-use the label one.
"label:" = a regular label is defined with a ":". You can use these if you want, but you can't re-use the name once you declared it.
".db" = define byte. It defines a byte in a series/string of data. Use the "," to separate bytes. Some commands are WORD size, they must be stored as LSB,MSB format
"low()/high()" = low(some label or value) returns the LSB of a WORD data types. High returns the MSB. You only need this for jump style commands and loading a waveform.
"$" = if you want to use a hex number instead of a decimal number, prefix the value with a "$". You probably want to do this for negative numbers, especially WORD sized negative numbers.
The names of functions in the song examples are equates. They equate to a value. You can add/subtract/multiply/divide/use logic operations, etc on any value or function. The only function that you need to modify though, is the "rest" function. You add the rest period value to the function itself (it's an embedded operand in the command).
Also, PCEAS doesn't seem to like long lines of equates. I've broken my examples up into lines of less than 94 characters long. You'll get a syntax error on that line of it's too long. You don't need to end a line with a ",". I think that about covers it.
Oh, one more thing. Notes. PCEAS doesn't like "#" in the equate system, so all sharps use an "x". A normal note is "C2." and a sharp is "C2x". The middle number signifies the octave.
Oh, one more more thing. A command string ends with either: a "note" or a "rest" function. If you jump in a loop that has neither, the engine will lock in an infinite loop and freeze playback.
Edit: new url
Ver 1.0 - alexandria66.2mhost.com/~pcengine/music/Azasel.zip
.