Instructor Notes
March 24, 2008
Midterm
- too long
- best course of action?
Final Project Proposals
- what do we need to cover?
- windows
- random
- scoring
- ???
- other questions?
GameBoy Audio: General
- 4 sound circuits
1 & 2 are PWM, 3 plays wave patterns, and 4 is noise
- 2 sound channels (stereo), called SO1 (left) and SO2 (right)
- There is a line called Vin which can accept input from a microphone. From there you can route it back to either SO1 or SO2
- channels 1,2 and 4 have envelope functions, meaning you can have them automatically get louder or softer over time
- channel 1 has a sweep function, meaning you can get it to sweep up in pitch (chirp) or down automatically
- All channels have a duration parameter, or can be left continuously on
gbhw-snd.inc is an include file to help your code be more self-documenting when coding sound in your apps
hello-noise.asm demonstrates some basic concepts for producing sound on the GameBoy
General I/O Registers
- AUDVOL
- Controls volume of SO1 and SO2 (range 0 through 7, 7 is the loudest)
- Routes Vin to SO1 and/or SO2
- AUDTERM
- select which of the 4 circuits goes to which of the 2 output channels
- AUDENA
- turn all sound on or all sound off
- read only: find out which sound circuits are on
I/O Registers for Circuits 1 and 2
- AUD1LEN, AUD2LEN
- set duty cycle and sound length
- Sound length is 6 bits and = (64-x)*(1/256) seconds
Duty cycle. From gbspec lines 1220-1223:
Wave Duty: 00: 12.5% ( _--------_--------_-------- ) 01: 25% ( __-------__-------__------- ) 10: 50% ( ____-----____-----____----- ) (default) 11: 75% ( ______---______---______--- )
- AUD1ENV, AUD2ENV
- set an envelope to get either louder or softer
- set initial volume of envelope (4 bit)
- set envelope rate (3 bit). One step = x * (1/64) seconds
- AUD1SWEEP
- circuit 1 only
- sweep time (3 bit). Higher is slower
- sweep up or down
- change of frequency per shift: x(t) = x(t-1) +- x(t-1)/(2^n)
- AUD1LOW, AUD2LOW
- lower 8 bits of 11 bit number (x) representing a frequency: freq = 131072/(2048-x) Hz
- AUD1HIGH, AUD2HIGH
- choose if sound is continuous or indeed only the length you specified in AUD1LEN or AUD2LEN
- upper 3 bits of 11 bit number (x) (see AUD1LOW, AUD2LOW)
- trigger sound
Sound Circuit 3
overall
- Plays wave pattern ram at $ff30 to $ff3f
- stores in nibbles, reading high nibble first. 32 nibble memory
- play continuous sounds by continually shutting off circuit and reloading memory
I/O Registers
- AUD3ENA
- turn circuit 3 on or off
- AUD3LEN
- 8 bits to set sound length (256-x)*.5 seconds
- AUD3LEVEL
- bits 5 and 6:
- 00: mute
- 01: full volume
- 02: 1/2 volume
- 03: 1/4 volume
- bits 5 and 6:
- AUD3LOW, AUD3HIGH
- load 11 bit number representing equation for freq
- trigger sound
- choose whether or not continuous
Sound Circuit 4
overall
- uses binary polynomials to generate pseudo-random numbers (CRC check)
- mess with the parameters and get some interesting effects
I/O registers
- AUD4LEN --- just like AUD1LEN and AUD2LEN
- AUD4ENV --- just like AUD1ENV and AUD2ENV
- AUD4POLY: Parameters for the pseudo random number generator
- shift clock frequency (4 bits - )
- selection of polynomial counter step (7 or 15)
- dividing ratio of freqs (3 bits)
- AUD4GO
- set whether or not continuous
- trigger sound