Get accelerometer free from the frame-rate

Hi there! May i ask a help to understand how to get accelerometer free from frame-rate?
Currently i using it as the tutorial below teach,
I need sensor to drive sound fx, my currently framerate is only 16 fps and i can’t increase it,
How can i modify it to use it as a thread independent from draw void frame-rate?

This is my current situation about, that i learn form the link above

import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;

Context context;
SensorManager manager;
Sensor sensor;
AccelerometerListener listener;
float ax, ay, az;

void setup() {
  context = getActivity();
  manager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
  sensor = manager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
  listener = new AccelerometerListener();
  manager.registerListener(listener, sensor, SensorManager.SENSOR_DELAY_GAME);
  textFont(createFont("SansSerif", 30 * displayDensity));

void draw() {
  text("X: " + ax + "\nY: " + ay + "\nZ: " + az, 0, 0, width, height);

class AccelerometerListener implements SensorEventListener {
  public void onSensorChanged(SensorEvent event) {
    ax = event.values[0];
    ay = event.values[1];
    az = event.values[2];    
  public void onAccuracyChanged(Sensor sensor, int accuracy) {

Hi chanof,

Did you have a look at the thread() function?

Hi @jb4x yes i know and i want use it but i dont know how to apply it here
May i ask if you can show how?