Skip to content

Posts tagged ‘soundboard’

Android: Soundpool vs MediaPlayer (focus on soundboards and memory problems)

Aug 18 10
by mat

I get a fair few emails asking for help on making soundboards because I have a few out on the market currently, so this is one of a few mini-tutorials I am creating to explain some of the difficulties to overcome.

So there are two methods for playing sounds in android SoundPool and MediaPlayer.

SoundPool

SoundPool is designed for short clips which can be kept in memory decompressed for quick access, this is best suited for sound effects in apps or games. Using this method with soundboards is a bad idea as you will be loading lots of “medium” sized sounds into the memory and you may exceed your limit (16Mb) and get an OutOfMemoryException.

MediaPlayer

MediaPlayer is designed for longer sound files or streams, this is best suited for music files or larger files. The files will be loaded from disk each time create is called, this will save on memory space but introduce a small delay (not really noticeable).

So lets have a look how to use Media Player instead of SoundPool

MediaPlayer Usage

MediaPlayer mp = MediaPlayer.create(ClassName.this, R.raw.sound);
mp.start();

Where ClassName.this should be the name of your class (Hint: this should be the name of the java file you are editing)

You can pause the sound playing and then use start to start the sound playing again.

mp.pause(); // Stop
mp.start();   // Start from place paused

To stop the sound playing use stop, using start now will start playing the sound again from the beginning

mp.stop();    // Stop sound
mp.start();   // Start from beginning

To reset the media player so it can be reinitialised with a another sound

mp.reset();
mp = MediaPlayer.create(ClassName.this, R.raw.sound2);

To release the resources once you are finished media player (free memory)

mp.release();

My Soundboards

Below are a few screenshots of my current soundboards on the market

Portal 2 teaser trailer and soundboard updated

Jun 16 10
by mat

Valve have released a teaser trailer for Portal 2 (which is now due for release in 2011) and I have updated the portal soundboard (for android) to feature two new sounds included in this trailer.

Video

Soundboard

Portal 2 soundboard updated to include to new sounds from GLaDOS:
“It’s been a loooooooong time”
“I think we can put our differences behind us… for science… you monster…”

Download
Portal SoundBoard can be downloaded from the market on your android phone either by searching or following the android link below. Alternativly you can download the apk file from this website using the download link

Android: Portal Soundboard market link
Download: Portal Soundboard download link

qrcode

Portal Soundboard for Android released

Jun 15 10
by mat

Follow the success of my other soundboards (Unreal Tournament SoundBoard and Counter-Strike Soundboard ); I have released a Portal soundboard for Android:

Download
Portal SoundBoard can be downloaded from the market on your android phone either by searching or following the android link below. Alternativly you can download the apk file from this website using the download link

Android: Portal Soundboard market link
Download: Portal Soundboard download link

qrcode

Features

  • GLaDOS sounds (Loads of)
  • Extra sounds from the overly friendly turret
  • Still alive song, and the cake reciepe
  • Save sounds as ringtones and notifications
  • Optional Adverts (Menu > toggle ads to hide)

Screenshots

Portal Soundboard Screenshot 1

Portal Soundboard Screenshot 1


Portal Soundboard Screenshot 2

Portal Soundboard Screenshot 2

If you enjoyed this please leave feedback for me either here or on the market. Comments, suggestions and constructive criticism is also welcome.