Code example for Visualizer

Methods: getSamplingRatesetCaptureSize

0
    private int mCapturePeriodMs;
    private byte[] mFft = new byte[CAPTURE_SIZE];
 
    public EnergyProbe(int session) {
        try { 
            mVisualizer = new Visualizer(session);
            if (mVisualizer != null) {
                mVisualizer.setCaptureSize(CAPTURE_SIZE);
                mMaxFrequency = mVisualizer.getSamplingRate() / 2000;
                mCapturePeriodMs = 1000000 / mVisualizer.getMaxCaptureRate();
            } 
        } catch (UnsupportedOperationException e) {
            Log.e(TAG, "Error creating visualizer");
        } catch (IllegalStateException e) {
            Log.e(TAG, "Error configuring visualizer");
        } 
    } 
 
    public int capture(int freq) throws InterruptedException {
        int energy = 0;
Connect your IDE to all the code out there  Get Codota for Java