Skip to main content
. 2021 Feb 3;21(4):1035. doi: 10.3390/s21041035
Algorithm 2 Sound events clustering

Require: sub_events D, Δtth, Δyth, Tmax

Ensure: events E

  • 1:

    y = amplitude of a sub-event/event

  • 2:

    X ← first cluster to be grown, initialized with d0

  • 3:

    for each sub_event di of D do

  • 4:

    if (tXtdi < Δtth) & (|yXydi| < Δyth) then

  • 5:

      X ← X + d1

  • 6:

      y ← new weighted amplitude of X

  • 7:

    else

  • 8:

      insert di into E as a new cluster to be grown

  • 9:

    end if

  • 10:

    end for

  • 11:

    for each pair (Ei, Ei+1) in E do

  • 12:

    Elow← event of (Ei, Ei+1) with lowest score

  • 13:

    if (tEitEi+1 < Δtth) & (|yEiyEi+1| < Δyth||TElow<Tmax) then

  • 14:

      Merge Ei with Ei+1, the new y being weighted with respect to events widths

  • 15:

    end if

  • 16:

    end for