adding various improvements to the experience
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#include "../BoomCast_Waveshare_Arduino/boomcast_detector.h"
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
|
||||
int main() {
|
||||
BoomDetector detector(16000, 533, 32000, 16000, 48000,
|
||||
0.01f, 0.02f, 2.0f, 0.075f, 5.0f, 0.16f);
|
||||
int16_t sample;
|
||||
uint64_t frame = 0;
|
||||
while (std::fread(&sample, sizeof(sample), 1, stdin) == 1) {
|
||||
++frame;
|
||||
auto result = detector.process(float(sample) / 32768.0f);
|
||||
if (result == BoomDetector::Result::Trigger) std::printf("T %llu\n", (unsigned long long)frame);
|
||||
if (result == BoomDetector::Result::TailDone) {
|
||||
std::printf("E %llu\n", (unsigned long long)frame);
|
||||
detector.reset();
|
||||
}
|
||||
}
|
||||
std::printf("B %.8f\n", detector.baseline());
|
||||
}
|
||||
Reference in New Issue
Block a user