I am developing a bluetooth application.
I want to change the light color to the rhythm of the music. I have a set of colors, for example 10 colors. And the choice of color to the rhythm of the music.
I have done this:
mVisualizer = new Visualizer(0);
mVisualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[0]);
Visualizer.OnDataCaptureListener captureListener = new Visualizer.OnDataCaptureListener() {
@Override
public void onWaveFormDataCapture(Visualizer visualizer,
byte[] bytes, int samplingRate) {
}
@Override
public void onFftDataCapture(Visualizer visualizer, byte[] bytes,
int samplingRate) {
}
};
mVisualizer.setDataCaptureListener(captureListener,
Visualizer.getMaxCaptureRate() / 8, true, true);
mVisualizer.setEnabled(true);
Now the question arises: how can I analyze byte data to get the speed (maybe int?) And select a color.
Thanks for your reply.
source
share