gbdev/gb-asm-tutorial

Part II, Lesson 6

ISSOtm opened this issue · 9 comments

This lesson will introduce sound to the game. Sound effects are the most important, and will begin with simple "fire-and-forget" sound effects. The core intent is introducing the NRxy registers, their functionality, and basic APU concepts.

Music is optional, but some basic beeps would help introduce concepts that will be abstracted away when we introduce a music driver.

Sounds great! We may have to break this into smaller parts in the process but it's a great start.

Pandocs' Audio section should be used as a reference and the chapter should function as a way to expose better information there and make it a bit more "organic" with small easy tasks to follow (e.g. how to design a subroutine to produce a sound effect etc)

zlago commented

what do you mean by music? would a less scuffed version of my scuffed as hell driver from a few years ago which reads 32 bytes in a loop and uses a LUT to then play those bytes as notes (with hardcoded envelope and duty, and always lowest octave) count as music? if so, how would i de-scuff it? i wouldnt want to accidentally encourage people to use a somewhat compatibile format to the not-scuffed driver i plan on writting "one day"

The plan is not to use a driver at all yet, and directly write to NRxy. This is why music may not really be an option, and SFX are the most important part.

Here's my plan: turn on one of the square wave channels upon interaction with the paddle/walls/bricks and implement a frame timer to turn it off again. Atari style beeps and boops. Do you want to save things like duty cycle until later?

zlago commented

isnt that just writting $00 (sweep), $02 (len/duty), $a2 (vol/env), $xx (freq), and $8x (freq/retrig) to rNR10-rNR14? assuming NR50, NR51 and NR52 are all $ff

I think we should mention duty cycle, since it's a fairly simple concept, and is important to defining the wave being emitted. Besides, we can iterate on the design, it's no big deal if the first draft is not fully on point.

To be honest I haven't thought about sound registers in a while and didn't realize NRx1 can set duration! Perhaps a potential trap to point out in the tutorial text?

Is it a trap?

I've created a draft for this lesson.