L14_sound - GameBoy Advance Programming Sound Sound Basics...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
GameBoy Advance Programming Sound
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sound Basics
Background image of page 2
The Digital Process A / D Fs D / A Sound pressure fluctuations Sound pressure fluctuations Analog voltage Digital voltage Sampling frequency Sampled signal Analog voltage
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GBA Sound Four legacy sound effect channels We won't use these Dual digital channels Direct Sound A Direct Sound B Each has an 8-bit digital-to-analog converters (DACs) Play any sounds you want Well, at least within the capabilities of 8 bit sound
Background image of page 4
Sound Step by Step
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Getting the Sound Obtain any .wav file Get the free Switch program from http://www.nch.com.au/switch/ Convert your .wav file to PCM Uncompressed 11025Hz 16 bits Use wav2c.m to convert this new wav file to .c and .h files Add the files to your project
Background image of page 6
Sound Devices are Sensitive Sensitive Sound Device (DAC etc.) FIFO QUEUE FIFO QUEUE FIFO QUEUE FIFO QUEUE TIMER We tell the sound device to play a sample each time the timer times out. We tell the sound device to play a sample each time the timer times out.
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Calculating Timer Timing Set up a timer to send samples from FIFO to the sound chip at the right frequency Bit 10: Sound A sampling rate Timer Bit 14: Sound B sampling rate Timer 0 or 1 in each bit for Timer 0 or 1 Figure out clock cycles per sample 2^24 / soundSamplingRate = cycles / sample Set up a timer to overflow after that many cycles Initialize timer to value of 65536 – (# of cycles)
Background image of page 8
Example At 16.7 MHz, the CPU has exactly 16777216 (2^24) cycles per second To get the number of cycles per sample, divide 16777216 by the sampling rate.
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 39

L14_sound - GameBoy Advance Programming Sound Sound Basics...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online