Skip to content

Commit

Permalink
Add first draft of title music
Browse files Browse the repository at this point in the history
  • Loading branch information
mdsteele committed Sep 22, 2024
1 parent f47de34 commit a31f9a4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 14 deletions.
29 changes: 25 additions & 4 deletions src/inst.asm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
D_TABLE_HI table, Data_Instruments_func_ptr_1_arr
D_TABLE .enum, eInst
d_entry table, Constant, Func_InstrumentConstant
d_entry table, NoiseSnare, Func_InstrumentNoiseSnare
d_entry table, PulseBasic, Func_InstrumentPulseBasic
d_entry table, PulseEcho, Func_InstrumentPulseEcho
d_entry table, PulsePiano, Func_InstrumentPulsePiano
Expand Down Expand Up @@ -108,7 +109,7 @@ _Vibrato:
;; instrument for pitches right next to a TimerLo carry boundary, then
;; TimerHi wouldn't change anyway, and everything will sound fine.
_Envelope:
fall Func_InstrumentPulseBasic
fall Func_InstrumentPulseBasic ; preserves X
.ENDPROC

;;; A basic instrument for the pulse channels. The bottom four bits of the
Expand Down Expand Up @@ -181,7 +182,7 @@ _Decay:
div #2
rsub Zp_AudioTmp1_byte ; max volume
blt Func_InstrumentSilent
fall Func_CombineVolumeWithDuty
fall Func_CombineVolumeWithDuty ; preserves X
.ENDPROC

;;; Combines the given volume value with the pulse duty bits from the
Expand Down Expand Up @@ -249,6 +250,26 @@ _VibratoDelta_i8_arr4:
rts
.ENDPROC

;;; An instrument for the pulse and noise channels. The bottom four bits of
;;; the instrument param specify the initial volume, which starts fading out
;;; immediately. The top four bits of the instrument param specify a delta to
;;; add to the noise period (mod 16) after the initial hit.
;;; @param X The channel number (0-4) times four (so, 0, 4, 8, 12, or 16).
;;; @return A The duty/envelope byte to use.
;;; @preserve X
.PROC Func_InstrumentNoiseSnare
lda Ram_Music_sChanNote_arr + sChanNote::ElapsedFrames_u8, x
cmp #2
bne @done
lda Ram_Music_sChanInst_arr + sChanInst::Param_byte, x
div #$10
add Ram_Music_sChanNote_arr + sChanNote::TimerLo_byte, x
mod #$10
sta Hw_Channels_sChanRegs_arr5 + sChanRegs::TimerLo_wo, x
@done:
fall Func_InstrumentStaccato ; preserves X
.ENDPROC

;;; An instrument for the pulse and noise channels. The bottom four bits of
;;; the instrument param specify the initial volume, which starts fading out
;;; immediately. The top two bits of the instrument param specify the pulse
Expand All @@ -261,7 +282,7 @@ _VibratoDelta_i8_arr4:
and #bEnvelope::VolMask
sub Ram_Music_sChanNote_arr + sChanNote::ElapsedFrames_u8, x
bge Func_CombineVolumeWithDuty
fall Func_InstrumentSilent
fall Func_InstrumentSilent ; preserves X
.ENDPROC

;;; An instrument for the pulse and noise channels that silences the channel.
Expand Down Expand Up @@ -314,7 +335,7 @@ _Slide:
sta Ram_Music_sChanNote_arr + sChanNote::TimerHi_byte, x
@done:
_Vibrato:
fall Func_InstrumentTriangleVibrato
fall Func_InstrumentTriangleVibrato ; preserves X
.ENDPROC

;;; An instrument for the triangle channel that applies vibrato. The
Expand Down
1 change: 1 addition & 0 deletions src/inst.inc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
;;; Instruments that can be used for music notes.
.ENUM eInst
Constant
NoiseSnare
PulseBasic
PulseEcho
PulsePiano
Expand Down
9 changes: 8 additions & 1 deletion src/music/boss1.sng
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

!DPCM K Data_SampleKickDrum_arr657 657

!SONG Boss1 "A|BCCADDEEFFEEGGAB"
!SONG Boss1 "A|BCCHDDEEFFEEGGAB"

=tempo q28
=key 3# % F# minor
Expand Down Expand Up @@ -77,3 +77,10 @@ T| pTA ' pTA |
| pTG |
N| pNA :8 |
D| pDA :16 |

!PART H

2=:A2
T=:AT
N=:AN
D=:AD
40 changes: 31 additions & 9 deletions src/music/title.sng
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@
@PRGC_Title

!SONG Title "|A"
!SONG Title "D|ABC"

=tempo q30
=key 2# % D major
=tempo q40
=key 3b % c minor

!INST 1U RampUp $00
!INST TD TriangleDrum $20
!INST ND Staccato $0c
!INST 1H PulsePiano $08 d1/2
!INST 1Q PulsePiano $08 d1/4
!INST TV TriangleVibrato
!INST NS NoiseSnare $27 % snare drum

!PART D

T| iV c3w | e3w | a2h b2h | c3h. b2q |
N| p(iS x5e x4e+ ' +e x5s x4t x4t ' x5e x4e ' rq)NA :3 |
| p(iS x5e x4s x5s+ ' +s x4s x4t x4t x4t x4t ' x5e x4e ' x5e x4s x4t x4t)NB |

!PART A

1| iU d4e re d3q a3 d3 |
T| iD c4e re :4 |
N| iD x9e x0 :4 |
1| p(iQ g4e. fe. ce+q+e ave | a4e. ge. fe+q+e ce | g4e. fe. ce+q bvq)1A |
| e4q+e fh ce |
| p(iQ g4e. fe. ce+q+e ave | a4e. iH be. iQ c^e bve.+e. ce |
| a4e. ge. ee fq bvq | c4w)1B |
T| iV c3w | f3w | e3w | a2h b2h |
| c3w | a3w | a2h b2h | c3h. b2q |
N| pNB :8 |

!PART B

1| p1A | a3q e4q b3q+e c4e | p1B |
T=:AT
N=:AN

!PART C

T=:AT
N| pNA | pNA | pNB | pNA | pNA | pNA | pNA | pNB |

0 comments on commit a31f9a4

Please sign in to comment.