Making First Grade Math App Pop

First grade math app is incomplete without a few sound effects – Serge mentioned as much in his comment about the demo. Today, we recorded and processed a bubble pop sound to include in the game. The video shows how we did it.

The sound was recorded on a regular laptop, with commodity headphones. We shutdown any additional electronics in the room to reduce noise. And, also used Audacity to increase the volume, reduce noise and process the sound. The end result was a vorbis ogg file that we included in the eclipse project for First Grade Math. The SoundManager class is responsible for loading and playing the sound in First Grade Math. The SoundManager code – as promised in the video – is below.

public class SoundManager {

	static private SoundManager instance;

	private SoundPool mSoundPool;
	private AudioManager mAudioManager;

	private int yeah;
	private int tryagain;
	private int pop;
	private int crunch;

	private SoundManager() {

	}

	public static SoundManager getInstance() {
		return instance;
	}

	public static void init(Context theContext) {
		if (instance == null) {
			instance = new SoundManager();
			instance.mSoundPool = new SoundPool(2, AudioManager.STREAM_MUSIC, 0);
			instance.mAudioManager = (AudioManager) theContext.getSystemService(Context.AUDIO_SERVICE);

			// add sounds
			instance.yeah = instance.mSoundPool.load(theContext, R.raw.yeah, 1);
			instance.tryagain = instance.mSoundPool.load(theContext, R.raw.tryagain, 1);
			instance.pop = instance.mSoundPool.load(theContext, R.raw.pop, 1);
			instance.crunch = instance.mSoundPool.load(theContext, R.raw.crunch, 1);
		}
	}

	public void playYeah() {
		playSound(yeah);
	}

	public void playTryagain() {
		playSound(tryagain);
	}

	public void playCrunch() {
		playSound(crunch);
	}

	public void playPop() {
		playSound(pop);
	}

	public void playSound(int index) {
		if(mAudioManager!=null) {
			float streamVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
			streamVolume = streamVolume	/ mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
			mSoundPool.play(index, streamVolume, streamVolume, 1, 0, 1f);
		}
	}

	public void release() {
		mSoundPool.release();
		mSoundPool = null;
		if(mAudioManager!=null) {
			mAudioManager.unloadSoundEffects();
		}
	}
}

Technology has made it possible to create our own sound effects without a huge investment in a recording studio.

One thought on “Making First Grade Math App Pop

  1. Pingback: Ecosystem | Infinut

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s