Pause DBmeter

I’m building an app that needs to record sound every time a certain disciple count is reached, I’m using DBmeter plugin which runs in a loop so every time let’s say it reaches 80 disciples it runs functions inside the loop without waiting for other function to finish.
I tried using Promises but it doesn’t seem to work, and I tried tried to delete the DBmeter Instance which also doesn’t work (it records one and when I try to restart the DBmeter instance it stops working)

the code i’m using:

    this.subscription = this.dbMeter.start().subscribe(
      data => {
        this.count = Number(data);
        if(!this.ispaused && this.count >= 85){
          console.log('im in');
          this.triggered = true;
          this.ispaused = true;

    this.triggered = true;
    this.ispaused = true;

    let log = '';
    log += this.count.toString() + ' - ' + this.getTime();
    this.logsService.addLog(log).then(() => {
    this.recordNoise().then(() => {
      console.log('working ok');

    this.fileName = 'record'+new Date().getDate()+new Date().getMonth()+new Date().getFullYear()+new Date().getHours()+new Date().getMinutes()+new Date().getSeconds()+'.mp3';
      // this.filePath = this.file.dataDirectory.replace(/file:\/\//g, '') + this.fileName;
    // const fi: MediaObject ='test.mp3');
    const file: MediaObject =;
    window.setTimeout(() => file.stopRecord(), 7000);
    this.triggered = false;
this.ispaused = false;

I’ll preface this by saying that I’m not very confident that I understand what the problem is here.

I like to program backwards from consumers to producers. Here I see a consumer that wants to do this:

class EarService {
  listenUntilOver(thresh: number): Promise<void> {
    // here be magic

  recordSnippet(): Promise<MediaObject> {
    // more magic

class RecorderPage {
  constructor(private ears: EarService) {}
  cycle(): Promise<void> {
    return this.ears.listenUntilOver(85)
      .then(() => this.ears.recordSnippet())
      .then((mo) => this.doSomethingWithMediaObject(mo))
      .then(() => this.cycle());

Does that sound like an accurate summation of the goal?

We are just beginning in this world and we want to measure the noise level of a classroom and get values in dBA…do you think we can achieve that goal with the sensor you advised?I think the range measurement should be something like 0 to 80 dBA,isn´t it?