MCPcopy Create free account
hub / github.com/pyscript/pyscript / update

Method update

core/tests/manual/issue-2302/libfft.py:33–48  ·  view source on GitHub ↗
(self, data, running_time)

Source from the content-addressed store, hash-verified

31 # print('bs reset')
32
33 def update(self, data, running_time):
34 self._count += 1
35 self.since_last_beat = running_time - self._last_detection
36 d = sum(data[bin] for bin in self._bins)
37 if d < self._threshold:
38 self.on_beat = False
39 elif d - self._prev < self._diff:
40 self.on_beat = False
41 elif self.since_last_beat < self._cooldown:
42 self.on_beat = False
43 else:
44 self._last_detection = running_time
45 self.since_last_beat = 0
46 self.on_beat = True
47 self.beat += 1
48 self._prev = d
49
50@dataclass
51class FreqIntensity:

Callers 1

animateFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected