sound - GameBoy Advance Programming Sound Sound Basics The...

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

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

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

View Full Document Right Arrow Icon
Sound Basics
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
Image of page 3

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

View Full Document Right 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
Image of page 4
Sound Step by Step
Image of page 5

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

View Full Document Right Arrow Icon
Getting the Sound Obtain an 8-bit .wav file Convert to .bin using wav2gba.exe wav2gba <input.wav> <output.bin> Convert .bin to .c using bin2c.exe bin2c <input.bin> <output.c> Add the c file to your project Will be unsigned chars... Don't forget to extern it in your main file
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.
Image of page 7

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

View Full Document Right 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)
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.
Image of page 9

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern