Xylophone App Android Studio Java [With Project Files]
Xylophone App Android Studio Java
Xylophone is a musical instrument that plays by striking wooden bar on mallets. This feature is now available in app as android smartphone can simulate the same sound effect. This xylophone app is made using Android Stuido which is IDE android app development software by google. The app is very simple and easy to use. Just press the color buttons to play high quality xylophone sounds. All the project files are includes in the download link below. So, you can check out the actual project is built.
Hence, this app mainly uses a library provided by Android Studio IDE itself called SoundPool. SoundPool object simply contains collection sample sounds which can be loaded into memory inside from resource apk. In addition, SoundPool provides low-latency playback and simultanous number of playback which is not available in Audio Manager.
Furthermore, the features that SoundPool Library provides:
- Limit the number of simulateously sounds plays.
- Feature to control left and right volume.
- Loop feature
- Priority management(SoundPool will automatically stop previously sounds based on priority)
- Control on playback speed rate.
Example of SoundPool Object:
// TODO: Create a new SoundPool
private final int NR_OF_SIMULTANEOUS_SOUNDS = 7;
private final float LEFT_VOLUME = 1.0f;
private final float RIGHT_VOLUME = 1.0f;
private final int NO_LOOP = 0;
private final int PRIORITY = 0;
private final float NORMAL_PLAY_RATE = 1.0f;
//declare new soundpool object with parameters
mSoundPool = new SoundPool(NR_OF_SIMULTANEOUS_SOUNDS,AudioManager.STREAM_MUSIC,0);
//Define the soundpool object's sound from resources
mCSoundId = mSoundPool.load(getApplicationContext(),R.raw.note1_c,1);
// Trigger the SoundPool Object sound
mSoundPool.play(mCSoundId, LEFT_VOLUME, RIGHT_VOLUME, PRIORITY,NO_LOOP, NORMAL_PLAY_RATE);
Thus, SoundPool is effective when playing multiple sounds at same time.Therefore, You can find out the SoundPool Objects method ,constructor and other in here. Also, You can get the project in the link down below: