| |
oziphantom
Registered: Oct 2014 Posts: 490 |
GoatTracker and the random dropped notes
So every time I use Goattracker at some point I get "this song is dropping a note on a channel".. "it works fine when I export an prg and listen to it.
So I use bin files. It set to be at $3000/$6000 ( I have two files) and ZP is set to DB-DC. I'm playing it off a NMI, which is set to the frame rate, so it always plays in the same spot. The main loop is - jmp - so its doing nothing, IRQs are disabled.
initAudio
SEI
LDA #$7F
STA aDD0D ;CIA2: CIA Interrupt Control Register
lda CurrentSong
cmp #kSong1Max
bcs _song2
jsr SONG_1 ; init Song
LDA #<AudioNMI
STA aFFFA ;NMI
LDA #>AudioNMI
STA aFFFB ;NMI
jmp _setup
_song2
sec
sbc #kSong1Max
jsr SONG_2 ; init Song
LDA #<AudioNMI2
STA aFFFA ;NMI
LDA #>AudioNMI2
STA aFFFB ;NMI
_setup
lda #<19655
sta aDD04
lda #>19655
sta aDD05
lda #$0f
sta $D418
LDA #$00
; STA a20
; STA a21
; STA a22
LDA #$11
STA aDD0E ;CIA2: CIA Control Register A
LDA #$FF
STA a00
LDA #$35 ;Set Just IO
STA a01
LDA #$81
STA aDD0D ;CIA2: CIA Interrupt Control Register
RTS
exitNMIEnbNext
LDA #$81
STA aDD0D ;CIA2: CIA Interrupt Control Register
exitNMI
PLA
TAY
PLA
TAX
PLA
RTI
AudioNMI
PHA
TXA
PHA
TYA
PHA
LDA #$7F
STA aDD0D ;CIA2: CIA Interrupt Control Register
LDA aDD0D ;CIA2: CIA Interrupt Control Register
Bpl _bA0F7
;JMP jA123
inc $d020
jsr SONG_1+3 ; call goattracker
dec $d020
jmp exitNMIEnbNext
_bA0f7
jmp exitNMI
AudioNMI2
PHA
TXA
PHA
TYA
PHA
LDA #$7F
STA aDD0D ;CIA2: CIA Interrupt Control Register
LDA aDD0D ;CIA2: CIA Interrupt Control Register
Bpl _bA0F7
;JMP jA123
inc $d020
jsr SONG_2+3 ; call goattracker
dec $d020
jmp exitNMIEnbNext
_bA0f7
jmp exitNMI anybody got any ideas of what could be causing the "dropped notes" that randomly change to be happening? something extra I have to ensure I set up or call? |
|
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
IMO, best solution is just to not use unsafe ADSR values that are liable to drop notes or bug the attack. Buffered or full buffered playback can also help. When using 2-frame hardrestart, most ADSR values should actually be safe, buffered or not.
The editor basically is "too stable", while real playroutine will write the registers at different times depending on what code it needs to execute each frame.
Or better yet .. make your own player / editor :) |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
sure editor vs code would be different, but PRG export on machine, vs bin file export? We are comparing VICE to VICE ;) Although different export locations. The author assures me he is using hardreset of 2 for everything. |
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
The difference of .prg or .bin export should just be the inclusion of startaddress.
How is the composer driving the song when listening to it?
If the NMI was to somehow trigger twice in a frame, then it could cause ADSR bugs, as notes suddenly become shorter. |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
The usual wait for d012
.7000 sei
.7001 lda #$00 (subtune #)
.7003 jsr $0c00
.7006 lda $d012
.7009 cmp #$80
.700b bne $7006
.700d jsr $0c03
.7010 jmp $7006 |
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
Could be difference in badlines when the player is called in different part of the screen. Usually this takes very small (unsafe) decay or release values to cause trouble.
If you turn on full buffering, then the previous frame's SID values are dumped into SID in the beginning of the play call, resulting in the best possible stability. This causes the most CPU use, so regular buffering should be a preferable solution. |
| |
oziphantom
Registered: Oct 2014 Posts: 490 |
bad lines might be a cause..
If say setting the pulse width got cut in half, that might cause something odd? |
| |
cadaver
Registered: Feb 2002 Posts: 1160 |
If the pulse is making a fast modulation, or when it's crossing highbyte boundaries, it could have a half-wrong value (only lowbyte updated at first) for the duration of the badline.
TBH I haven't consciously noticed or thought about this.
But if you want the best possible fidelity for SID write "grouping", use full buffering, and call the player outside the screen. |