Phaser4 - ZX Spectrum beeper music engine
Original code and 1tracker version by Shiru 01'23



Two channel engine with two channel of phasing synth with 99 
customizeable instruments and 8 customizeable sampled drums. 

A much similar but also much improved version of the previous Phaser3
engine. Compared to the previous installment, it features higher
sound quality, and way more synthesis algorithms and timbres.

Engine uses sampled drums that can be imported from WAV files. The
code it uses has been borrowed from Ear Shaver EX and offers more
advanced features compared to Phaser3, like volume, pitch, and offset
controls.


Each tone channel of the engine features a couple of 16-bit oscillators
that can be mixed in a number of ways, and be detuned to each other.

The engine uses instrument definitions that provide many parameters to
control the sound synthesis:


Semitone: 		An offset between oscillators, 0 to 96 semitones.

Detune: 		A fine detune between oscillators, 0..255.

Phase: 			Specific phase offset that is set at beginning of each
                note in case of Phase reset being enabled, 0..254.

Phase reset:	Enable or disable phase reset at beginning of each new
                note. Yes means reset the phase to the value above,
				No means a free running phase.

Phase drift:	Phase drift that slowly gets phase of both generators
                equal to each other. It is only useable with Detune set
				to 0. The range is 0..255. Lower value means faster drift.
				This feature allows to create sound similar to the pin
				pulse engines, by setting mix mode to XOR, Phase to a low
				value, like 8-16, and Phase drift to some non-zero value. 

Mix mode:		A number of oscillator mixing modes that produce various
				sound timbres. The modes are

	XOR, OR, AND:	The same as in Phaser3;
	CP:				The CrossPhase method first introduced in Ear Shaver EX;
	ADC:			A fat octaving noisy timbre;
	SUBH:			More noise in a timbre similar to ADC;
	SUBL:			A very noisy yet still mostly tonal timbre;
	Noise1:			Periodic noise of one kind;
	Noise2:			periodic noise of another kind.
	
				Mix modes can actually be intermixed within the same channel.
				There are four slots, which normally share the same mixing
				mode, but it can be set to different mixing modes to create
				even more timbres.

Volume:			A virtual volume. It is a bit mask, so despite there are 16
				possible values in the range of 0..15, only four of them,
				1, 3, 7, and 15, create new volume levels. It brings a very
				noticeable carrier tone into the sound, so this feature has
				a very limited use.

Tone slide 1:
Tone slide 2:	A separate pitch slide for each of the oscillators. It has a
				limited range of -4 to 4 (fastest down to no slide to fastest
				up), and no limits on the upper and lower boundaries, so the
				sound has to be stopped manually.



The columns are:

Sp T1 I1 T2 I2 DRvpo
.. ..... ..... .....
   |   | |   | |   |
   +ch1+ +ch2+ +drum
   
Sp : Speed, 1..99

T1,T2 : Tone channels
 Tn : Note, C-0..B-9
 In : Instrument number, 1..99
 
DR  : Drum, 1..99
 v  : Drum volume, 1..4 (quiet to loud, 4 by default)
 p  : Drum pitch, 1..9 (lowest to normal, 9 by default)
 o  : Drum sample offset, 1..9 (no offset by default)
