Topic: A new engine idea, more sound dynamics

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.

Post's attachments

test.sna 48.03 kb, 4 downloads since 2016-01-17 

You don't have the permssions to download the attachments of this post.
website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: A new engine idea, more sound dynamics

It sounds great. If you make something with this, I'll make an ambient tune for sure! wink

Re: A new engine idea, more sound dynamics

Oh wow, that's exactly the type of timbre effect I've been phantasizing about.
I could try to implement it for TI (6 MHz), but on the other hand the target audience for that is tiny (basically boils down to garvalf and myself at the moment), so I'm not really motivated to spend my time on it.
Do you think you could get it to work in 3.5 MHz by going back to Phaser1 (ie, one channel with the effect and one without), and perhaps using a partially unrolled sound loop (ie updating frequency counters one at a time instead of both each loop iteration)?