Hello,
I am currently making a soundboard with a standard template from myandroidsoundboard.com - I am having a problem with some of the files. I take the mp3 file and convert it in Audacity to OGG files. When it is loaded into the soundboard res/raw folder and I then run the emulator it will play the song for roughly 2-3 seconds.
I was advised to convert the OGG file to 16 bit 11025HZ, but when I do this (tv show theme song for example) or any file for that matter becomes REALLY SLOW!
Has anyone ran into this problem before? I have searched everywhere and I am unable to find a solution.
Thank you.
edit: I am using up to date version of Eclipse.
I tried using that site and code for a soundboard but found it was no good at all, sounds will repeat endlessly for as many button clicks as you press, I'd avise you to use media player if you're looking to create a sound board.
Add MediaPlayer FilmSound;
just under your class
public class Soundboard extends Activity {
MediaPlayer FilmSound;
like so, remembering to import the media player with ctrl shift and o
then add
Button dollar = (Button)findViewById(R.id.Dollar);
FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.buythat);
dollar.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
if (FilmSound.isPlaying())
{
FilmSound.stop();
FilmSound.reset();
FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.buythat);
FilmSound.start();
}
else {
FilmSound = MediaPlayer.create(getApplicationContext(), R.raw.buythat);
FilmSound.start(); }
}
});
dollar being the button id, so change to your own, for some odd reason, my code needs to have the film sound variable three times for one of the sound samples, otherwise crashes out.
You can now use samples at any rate you like.
The reason it slows down is the frequncy is reduced, so you're stretching the sound out, like a bit of toffee.
Bookmarks