The 1-bit ambient thread made me think of combining Phaser and QChan like synthesis in one. This would give us both dynamic timbral changes of the Phaser synth and volume envelopes.
The approach:
- remember old output value of the 16-bit generator pair
- do the phaser stuff
- compare old value with the new one
- if there was change, generate a pin of desired duration (hence 'volume')
The question is how to do all this fast enough, to get at least two channel polyphony. Well, if 3.5 MHz is not enough, this still could be useful for something faster than ZX Spectrum.
Here is a crude proof-of-concept code:
begin
ld hl,0
ld ix,0
ld bc,2000
ld de,2001
loop
phase=$+1
ld a,0
ld (prevphase),a
add hl,bc
jr c,$+4 ;7/12 - note that this part could be replaced with sbc a,a, this gives a different kind of sound
jr $+4 ;7/12
xor 16 ;7
add ix,de
jr c,$+4 ;7/12
jr $+4 ;7/12
xor 16 ;7 - should be 255 in case with sbc a,a above
prevphase=$+1
cp 0
ld (phase),a
jr nz,pin ; there was change, generating a pin
exx ; otherwise keep steady timing (roughly in this case)
ld b,20
djnz $
exx
jp loop
pin
exa
exx
volume=$+1
ld c,15 ;this is volume 0..15, can be changed with an envelope in the outer loop, giving us slow attacks and decays
ld a,16
out (#fe),a
ld b,c
inc b
djnz $
xor a
out (#fe),a
ld a,c
xor 15
ld b,a
inc b
djnz $
exx
exa
jp loop
Compiled test is attached, there is no volume changes though, just to evalate the sound. Isn't too great, and has artifacts, but the volume (once changed manually) works pretty well.