5

I'm developing a bluetooth light app.

I want to change the light color by music beat. I have an array of colors, for example 10 colors. And a choice of color by music beat.

I had do 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) {
            //how I can do
        }

        @Override
        public void onFftDataCapture(Visualizer visualizer, byte[] bytes,
                                     int samplingRate) {
            //how I can do
        }
    };

    mVisualizer.setDataCaptureListener(captureListener,
            Visualizer.getMaxCaptureRate() / 8, true, true);
    mVisualizer.setEnabled(true);

Now the question is: How can I analyze byte data to get rate(probably an int?) and pick a color.

Thank for your reply.

Biswajit_86
  • 3,661
  • 2
  • 22
  • 36
user3875388
  • 541
  • 1
  • 6
  • 19

0 Answers0