i have a java project for calculating bpm and converted into android. in java it gives output for any length of mp3 files but in android it gives output for less than 2 minute song. if give 5 minute song it force quited.
my main activity code is:
import java.util.logging.Logger;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
public class Main extends Activity {
TextView text;
/** Called when the activity is first created. */
static Logger log = Logger.getLogger("BeatIt");
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text=(TextView)findViewById(R.id.text);
BPM2SampleProcessor processor = new BPM2SampleProcessor();
Log.e("bpm","1");
processor.setSampleSize(1024);
Log.e("bpm","2");
EnergyOutputAudioDevice output = new EnergyOutputAudioDevice(processor);
Log.e("bpm","3");
output.setAverageLength(1024);
Log.e("bpm","4");
try {
Player player = new Player(new FileInputStream("//sdcard//taxi.mp3"), output);
player.play();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (JavaLayerException e) {
e.printStackTrace();
}
text.setText("bpm is "+processor.getBPM());
Log.e("bpm", "5");
Log.e("bpm"," bpm is "+processor.getBPM());
}
}
my main activity code is:
import java.util.logging.Logger;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;
public class Main extends Activity {
TextView text;
/** Called when the activity is first created. */
static Logger log = Logger.getLogger("BeatIt");
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text=(TextView)findViewById(R.id.text);
BPM2SampleProcessor processor = new BPM2SampleProcessor();
Log.e("bpm","1");
processor.setSampleSize(1024);
Log.e("bpm","2");
EnergyOutputAudioDevice output = new EnergyOutputAudioDevice(processor);
Log.e("bpm","3");
output.setAverageLength(1024);
Log.e("bpm","4");
try {
Player player = new Player(new FileInputStream("//sdcard//taxi.mp3"), output);
player.play();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (JavaLayerException e) {
e.printStackTrace();
}
text.setText("bpm is "+processor.getBPM());
Log.e("bpm", "5");
Log.e("bpm"," bpm is "+processor.getBPM());
}
}