Processing.sound SoundFile in Android

Hello Guys
I am very new both processing and android.
I would use an example “beat detection” using processing.sound in android.
I want to vibrate my phone when beat is detected as shown below code.
Can anyone help me to fix below my code?
Any example codes will be greateful!!
Thank you in advance for your fruitful advise and any help.
James.

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.os.VibrationEffect;
import android.os.Vibrator;

import apwidgets.APMediaPlayer;
import processing.core.PApplet;
import processing.sound.FFT;
import processing.sound.SoundFile;
import processing.sound.Waveform;

public class Sketch extends PApplet {
    Activity act;
    Context mC;
    APMediaPlayer player;

    Vibrator vibrator;
    int noOfSamples = 1024;

    SoundFile sample;
    Waveform waveform;
    FFT fft;
    int bands = 256;
    double detectionValue = 0.22;

    public void settings() {
        size(getScreenWidth(), getScreenHeight());
    }

    public void setup(){
        //initPlay();
        background(0);
        //background(255);

        // Load and play a soundfile and loop it.
        //https://discourse.processing.org/t/a-sound-play-exemplar-please/416
        //https://discourse.processing.org/t/a-sound-play-exemplar-please/416/5
        sample = new SoundFile(this,"Remix Bass Boosted.wav");
//        player = new APMediaPlayer(this);
//        player.setMediaFile("assets/Remix Bass Boosted.wav");
//        sample = new SoundFile(player);
        sample.loop();

        // Create the Waveform analyzer and connect the playing soundfile to it.
        waveform = new Waveform(this, noOfSamples);
        waveform.input(sample);

        fft = new FFT(this, bands);
        fft.input(sample);

        //re-draw
        frameRate(60);
    }

    public void draw(){
        strokeWeight(2);
        noFill();
        waveform.analyze();

       // Detect beat
        boolean beatDetected = false;

        int detectionCount = 0;

        for (int i = 0; i < noOfSamples / 4; i++){
            float posValue;

            if (waveform.data[i] < 0 ) posValue = -waveform.data[i];
            else posValue = waveform.data[i];

            if( posValue > detectionValue ){
                detectionCount++;
            }
        }

       if (detectionCount > 86){
            beatDetected = true;
        }


        if (beatDetected)
        {
//            vibrator = (Vibrator) getActivity.getSystemService(Context.VIBRATOR_SERVICE);
//            vibrator.vibrate(100);
            if (Build.VERSION.SDK_INT >= 26){
                vibrator.vibrate(VibrationEffect.createOneShot(200, VibrationEffect.DEFAULT_AMPLITUDE));
            } else {
                vibrator.vibrate(200);
            }
            textSize(48);
            text("BEAT", 100,100);
        }
        stroke(1,1,1);
    }

    public static int getScreenWidth(){
        return Resources.getSystem().getDisplayMetrics().widthPixels;
    }
    public static int getScreenHeight(){
        return Resources.getSystem().getDisplayMetrics().heightPixels;
    }
}

It compiled without error but it just shut down with log from logcat as shown belows;

2022-04-27 22:56:31.338 31652-31712/com.example.tutorial E/AndroidRuntime: FATAL EXCEPTION: Animation Thread
    Process: com.example.tutorial, PID: 31652
    java.lang.NoClassDefFoundError: Failed resolution of: Lcom/jsyn/engine/SynthesisEngine;
        at processing.sound.Engine.<init>(Unknown Source:13)
        at processing.sound.Engine.getEngine(Unknown Source:6)
        at processing.sound.SoundObject.<init>(Unknown Source:10)
        at processing.sound.AudioSample.<init>(Unknown Source:0)
        at processing.sound.SoundFile.<init>(Unknown Source:0)
        at processing.sound.SoundFile.<init>(Unknown Source:1)
        at com.example.tutorial.Sketch.setup(Sketch.java:51)
        at processing.core.PApplet.handleDraw(PApplet.java:1878)
        at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:478)
        at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:518)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.jsyn.engine.SynthesisEngine" on path: DexPathList[[zip file "/data/app/com.example.tutorial-gFKqvlxGiMNBkGSk9ttFqg==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.tutorial-gFKqvlxGiMNBkGSk9ttFqg==/lib/arm64, /system/lib64, /system/vendor/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at processing.sound.Engine.<init>(Unknown Source:13) 
        at processing.sound.Engine.getEngine(Unknown Source:6) 
        at processing.sound.SoundObject.<init>(Unknown Source:10) 
        at processing.sound.AudioSample.<init>(Unknown Source:0) 
        at processing.sound.SoundFile.<init>(Unknown Source:0) 
        at processing.sound.SoundFile.<init>(Unknown Source:1) 
        at com.example.tutorial.Sketch.setup(Sketch.java:51) 
        at processing.core.PApplet.handleDraw(PApplet.java:1878) 
        at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:478) 
        at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:518) 
2022-04-27 22:56:31.353 31652-31712/com.example.tutorial I/Process: Sending signal. PID: 31652 SIG: 9

Hi

Here is how to vibrate with mouse hope it’s help

import android.app.Activity;
import android.content.Context;
import android.os.Vibrator;


Activity det;

void setup() {
  fullScreen();
  background(255, 0, 0);
  det = this.getActivity();
}


void draw() {
  background(0, 255, 0);
}

void mouseReleased() {
  Vibrator vibrer = (Vibrator)   det.getSystemService(Context.VIBRATOR_SERVICE);
  vibrer.vibrate(300);
}