Rhythm Game Music Tutorial

Tutorial Nesmaker Music Timing

Hello, it's ya boi Klumpus again! First Tutorial! made this work months ago, however never made the full game
or even continue yet due to needing to either learn to make music then or especially now...
anyway, it's very simple actually! but currently only after you follow this low-mediumish tutorial by CutterCross!
https://www.nesmakers.com/index.php?threads/4-5-6-implementing-dpcm-sample-playback.6098/

and maybe set AllSongs_WithSFX to something like this:

song_index_MytestSong = 0

sfx_index_sfx_blank = 0

song_list:
.dw _MytestSong

sfx_list:
.dw _sfx_blank

instrument_list:
.dw _DPCM_0
.dw _NoteCut_1
.dw _Beepus_2
.dw silent_3

dpcm_list:
.dw dpcm_samples_list
.dw dpcm_note_to_sample_index
.dw dpcm_note_to_sample_length
.dw dpcm_note_to_loop_pitch_index

_DPCM_0:
.db 5,7,9,11,ARP_TYPE_ABSOLUTE
.db 1,ENV_STOP
.db 0,ENV_STOP
.db 0,DUTY_ENV_STOP
.db ENV_STOP

_NoteCut_1:
.db 5,7,9,11,ARP_TYPE_ABSOLUTE
.db 1,ENV_STOP
.db 0,ENV_STOP
.db 0,DUTY_ENV_STOP
.db ENV_STOP

_Beepus_2:
.db 5,10,16,20,ARP_TYPE_ABSOLUTE
.db 2,3,2,0,ENV_STOP
.db -8,26,33,55,80,ENV_STOP
.db 64,64,64,DUTY_ENV_STOP
.db ENV_STOP

silent_3:
.db 5,7,9,11,ARP_TYPE_ABSOLUTE
.db 0,ENV_STOP
.db 0,ENV_STOP
.db 0,DUTY_ENV_STOP
.db ENV_STOP

dpcm_samples_list:
.db <(dpcm_sample_E >> 6)

dpcm_note_to_sample_index:
.db $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
.db $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$00,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
.db $ff,$ff,$ff,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 0
.dw 0
.dw 0
.dw _MytestSong_dpcm

_MytestSong_dpcm:
_MytestSong_dpcm_loop:
.db CAL,<(_MytestSong_dpcm_0),>(_MytestSong_dpcm_0)
.db GOT
.dw _MytestSong_dpcm_loop

_MytestSong_dpcm_0:
.db STI,3,SL7,A0,STI,0,SL0,C3,SL2,C3
.db RET

_sfx_blank:
.db 0, 1
.db 0, 1
.dw 0
.dw 0
.dw 0
.dw 0
.dw 0

and finally also maybe increase memory with JamesNES's Tutorial on it:

Okay, Here we go!

Step 1:
in ggsound.asm goto around line 880 and add this under @notePlayed!
lda #$01
sta beatZ
UpdateHudElement #$01
and Ironically enough End/Step 2:
set boolean to zero after the sound basically ends with a small timer! I did this in my MainGameLoop.asm
;;Handle Rythym
HandleGameTimer:
LDA myFrames
CMP #$00
BEQ +setRythym
DEC myFrames
jmp +skip
+setRythym
LDA #$20
STA myFrames
lda #$00
sta beatZ
UpdateHudElement #$01
+skip
and that's it! have a good day everyone!
 
Top Bottom