I would like to see some of the AY files from project AY (
http://www.worldofspectrum.org/projectay/) adapted to be used on the ZXPand. They could be used as Music demos and it would attract even more people to the ZXPand.
I'm very tired right now so forgive me if this question was already answered. Since one of the undocumented features of the AY is digital sample playback and the ZXPand now as an AY, can we make the ZX81 "talk"? Can we make it play a short 4-bit-quality audio file using a 11025Hz raw, unsigned 8-bit mono WAV file as the starting point?
Here's the WAV AY player code created by Matt Wescott which has been successfully used on faster Sinclair computers. Please let me know if this can be modified to be used on the ZX81:
Code: Select all
; sample player
; need 317 tstates per sample
org 32768
ld hl,33000 ; start address of sample data
ld bc,20007 ; length of sample data, in bytes
push bc
ld a,7 ; set bits 0-5 of AY register 7 so that all channels are fixed at 'high'
ld bc,0xfffd ; output - this way the AY is not generating waveforms of its own, and
out (c),a ; varying the volume (channels 8/9/10) creates our own wave output instead
ld a,63
ld b,0xbf
out (c),a
pop bc
di ; disable interrupts, so that they don't mess with our carefully planned timings
samplelp
push bc ; 11
; get low 4 bits to use as the first volume level
ld a,(hl) ; 7
and 0x0f ; 7
; delay 117ish tstates
ld b,8 ; 7
zzz2 djnz zzz2
; output that volume level to channels 8/9/10
ld bc,0xfffd ; 10
ld d,8 ; 7
out (c),d ; 12
ld b,0xbf ; 7
out (c),a ; 12
inc d ; 4
ld b,0xff ; 7
out (c),d ; 12
ld b,0xbf ; 7
out (c),a ; 12
inc d ; 4
ld b,0xff ; 7
out (c),d ; 12
ld b,0xbf ; 7
out (c),a ; 12
; get the next volume level from the high 4 bits
ld a,(hl) ; 7 ; start tstate count here
srl a ; 8
srl a ; 8
srl a ; 8
srl a ; 8
; delay 152ish tstates
ld b,11 ; 7
zzz1 djnz zzz1
; 8
; output that volume level to channels 8/9/10
ld b,0xff ; 7
ld d,8 ; 7
out (c),d ; 12
ld b,0xbf ; 7
out (c),a ; 12
inc d ; 4
ld b,0xff ; 7
out (c),d ; 12
ld b,0xbf ; 7
out (c),a ; 12
inc d ; 4
ld b,0xff ; 7
out (c),d ; 12
ld b,0xbf ; 4
out (c),a ; 12
; move on to next byte
inc hl ; 6
; loop if we haven't reached the end of the sample
pop bc ; 11
dec bc ; 6
ld a,b ; 4
or c ; 4
jr nz,samplelp ; 12
ei
ret