Giter VIP home page Giter VIP logo

gba-sound-demo's Introduction

GBA Sound Demo

These demos allow you to experiment with different sample rates and bit depths on the Game Boy Advance.

The GBA is notorious for having bad sound. Using these demos, you can verify that the GBA hardware is quite capable of good sound, but it takes special care to setup the timing correctly to produce a 32K sample rate.

The source code is included, as .gvasm files.

Read the technical details for more information on how this works.

Playing the Demos

The .gba files are in the repo, so you can download them directly:

Both demos have a blinking indicator in the bottom left -- this is used to verify that timing is correct when using timer based sample rates (16K, 32K, 65K). Blinking indicates that the VBlank and Timer IRQ fired at the same exact time.

Rates Demo

rates.gba

The rates demo will play a tone, and allow you to switch the sample rate, bit depth, dithering, and hardware sample rate.

Controls:

  • L/R - sweep tone
  • Start - set tone to 256Hz
  • Select - set tone to 4096Hz
  • D-pad - change settings
  • A/B - change between top or bottom settings (for quick comparison)

The top number is the sample rate of the generated tone.

The bottom numbers are the bit depth and hardware sample rate (set via SOUNDBIAS), along with whether dithering is used when generating the tone.

Song Demo

song.gba

The song demo will play a song at two sample rates -- the top is controlled via vblank, the bottom is controlled via timers.

Controls:

  • Start - restart song
  • Anything else - swap between sample rates

How to Build

You will need gvasm v1 to assemble the .gvasm files into .gba files.

After install gvasm, run:

gvasm make rates.gvasm

In order to build the song demo, you must first download some music.

Here's what I did:

  1. Installed youtube-dl

  2. Installed sox

  3. Downloaded the Super Mario 3 Medley:

youtube-dl -x --audio-format wav -o song.temp --prefer-ffmpeg \
  'https://www.youtube.com/watch?v=5Nu6BxCnyE0'
  1. Convert it to 13K/8-Bit and 32K/8-Bit:
sox song.wav -r 13379 -b 8 -c 1 song-A.wav
sox song.wav -r 13379 -b 8 -c 1 song-A.raw
sox song.wav -r 32768 -b 8 -c 1 song-B.wav
sox song.wav -r 32768 -b 8 -c 1 song-B.raw
  1. Build the .gba file:
gvasm make song.gvasm

gba-sound-demo's People

Contributors

velipso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.