Too much noisy. This is not the solution
@WYZ
change the player using always the same delay between out instuctions
Replace the out part with this:
OUT (#A0),A
OUT (C),B
INC A
OUT (#A0),A
OUT (C),D
INC A
OUT (#A0),A
OUT (C),E
Moreover you need initialize register 7 disabling all channels!!!
Or you disable all the channels in the register 7 or you
set frequency 0 at all the channels and noise generators!!
A last (unuseful) advise... disable interrupts!
That's already done, and nothing changes:
sound(6)=&b11111111
sound(7)=0
sound(8)=0
sound(9)=0
sound(10)=0
JPBC0: CALL PLAY_SAMPLE RET ;SOUND C,A SOUND: PUSH AF LD A,C OUT [$A0],A POP AF OUT [$A1],A RET PLAY_SAMPLE: ; HL = SAMPLE TO PLAY [8bit unsigned] ; DE = LENGHT TO PLAY ; TABLE = ADDRESS OF SAMPLE TABLE ; DI EXX LD C,$A1 EXX LOOP: LD A,[HL] EXX LD L,A LD H,0 LD D,H LD E,L ADD HL,HL ADD HL,DE LD DE,TABLE ADD HL,DE LD B,[HL] INC HL LD D,[HL] INC HL LD E,[HL] LD A,8 OUT [$A0],A OUT [C],B INC A OUT [$A0],A OUT [C],D INC A OUT [$A0],A OUT [C],E LD B,8 DLYB0: DJNZ DLYB0 EXX INC HL DEC DE LD A,D OR E JP NZ,LOOP RET
change the player using always the same delay between out instuctions
This actually makes things worse. There is only one way of making samples less noicy and that is to maximize speed.
First OUT only selects register, so it does not change yet anything. That is why it is irrelevant when it is done. For rest of the OUTs, faster is better because then speaker has less time to go to "wrong" position.
Try
START: di
XOR A
LD C,0
CALL SOUND
inc c ; 1
CALL SOUND
inc c ; 2
CALL SOUND
inc c ; 3
CALL SOUND
inc c ; 4
CALL SOUND
inc c ; 5
CALL SOUND
inc c ; 6
CALL SOUND
inc c ; 7
LD A,00111111B
CALL SOUND
LD HL,SAMPLE
LD DE,$4670
CALL PLAY_SAMPLE
ei
RET
Upper two bits of Register 7 should always be %10xxxxxx
Tried. And this is the generated .bin file:
http://webs.ono.com/WYZ/8BIT_last.bin
No changes....
the code:
I cannot understand why there is such a noise...
Actually your best result is
Total error: 0,20568 (range: 1,31)
and not 1.328
No, 1.328 is, it’s just not in the list (which has 0,01 increments) but I did test it locally with 0.001 increments.
~Grauw