From f8472f5c4cb9206c80ca3b0530c6924eb35efdc2 Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Fri, 30 May 2025 21:46:58 +0200 Subject: [PATCH] wip --- process_chunks.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/process_chunks.py b/process_chunks.py index e016621..a055dc8 100755 --- a/process_chunks.py +++ b/process_chunks.py @@ -15,7 +15,7 @@ EVENT_DIR = "events" SAMPLE_SECONDS = 1 TOLERANCE = 2 OVERTONE_TOLERANCE = TOLERANCE * 2 -THRESHOLD_BASE = 0. +THRESHOLD_BASE = 0.1 THRESHOLD_OCT = THRESHOLD_BASE / 10 CLIP_PADDING_BEFORE = 1 CLIP_PADDING_AFTER = 6 @@ -72,20 +72,20 @@ def process_chunk(filename): event_time = event_time_dt.strftime("%Y%m%d-%H%M%S") base_name = os.path.splitext(filename)[0] - flac_out = os.path.join(EVENT_DIR, f"{base_name}_{event_time}.flac") - png_out = os.path.join(EVENT_DIR, f"{base_name}_{event_time}.png") + flac_out = os.path.join(EVENT_DIR, f"{event_time}.flac") + png_out = os.path.join(EVENT_DIR, f"{event_time}.png") sf.write(flac_out, clip, samplerate, format='FLAC') plt.figure() plt.specgram(clip, Fs=samplerate, NFFT=NFFT, noverlap=NFFT//2, cmap='inferno', vmin=-90, vmax=-20) - plt.title(f"Spectrogram: {base_name}_{event_time}") + plt.title(f"Spectrogram: {event_time}") plt.xlabel("Time (s)") plt.ylabel("Frequency (Hz)") plt.colorbar(label="dB") plt.savefig(png_out) plt.close() - print(f"Event: {event_time} peak_freq: {int(peak_freq)} base_energy: {int(base_energy)} oct_energy: {int(oct_energy)} total_energy: {int(total_energy)}") + print(f"Event: {event_time} peak_freq: {peak_freq:.9f} Hz, base_energy: {base_energy:.9f}, oct_energy: {oct_energy:.9f}, total_energy: {total_energy:.9f}") last_event = i i += skip_samples else: