wip
This commit is contained in:
parent
4ce4b5eede
commit
c78ad80aae
1 changed files with 7 additions and 7 deletions
|
@ -8,8 +8,8 @@ import scipy.signal
|
|||
from datetime import datetime
|
||||
import shutil
|
||||
|
||||
OUTDIR = "chunks_unprocessed"
|
||||
PROCESSED_DIR = "chunks_processed"
|
||||
INPUT_DIR = "chunks"
|
||||
OUTPUT_DIR = "chunks/processed"
|
||||
CHUNK_SECONDS = 1
|
||||
TOLERANCE = 1
|
||||
OVERTONE_TOLERANCE = TOLERANCE * 2
|
||||
|
@ -34,7 +34,7 @@ def detect_event(chunk, samplerate):
|
|||
return base_energy > THRESHOLD_BASE * total_energy and oct_energy > THRESHOLD_OCT * total_energy
|
||||
|
||||
def process_chunk(filename):
|
||||
input_path = os.path.join(OUTDIR, filename)
|
||||
input_path = os.path.join(INPUT_DIR, filename)
|
||||
print(f"🔍 Verarbeite {input_path}...")
|
||||
|
||||
# Frequenzanalyse und Event-Erkennung
|
||||
|
@ -58,8 +58,8 @@ def process_chunk(filename):
|
|||
|
||||
event_time = datetime.now().strftime("%Y%m%d-%H%M%S")
|
||||
base_name = os.path.splitext(filename)[0]
|
||||
wav_out = os.path.join(PROCESSED_DIR, f"{base_name}_{event_time}.wav")
|
||||
png_out = os.path.join(PROCESSED_DIR, f"{base_name}_{event_time}.png")
|
||||
wav_out = os.path.join(OUTPUT_DIR, f"{base_name}_{event_time}.wav")
|
||||
png_out = os.path.join(OUTPUT_DIR, f"{base_name}_{event_time}.png")
|
||||
sf.write(wav_out, clip, samplerate)
|
||||
|
||||
plt.figure()
|
||||
|
@ -78,13 +78,13 @@ def process_chunk(filename):
|
|||
i += chunk_samples
|
||||
|
||||
# Datei verschieben
|
||||
output_path = os.path.join(PROCESSED_DIR, filename)
|
||||
output_path = os.path.join(OUTPUT_DIR, filename)
|
||||
shutil.move(input_path, output_path)
|
||||
print(f"✅ Verschoben nach {output_path}")
|
||||
|
||||
|
||||
def main():
|
||||
for filename in os.listdir(OUTDIR):
|
||||
for filename in os.listdir(INPUT_DIR):
|
||||
if filename.endswith(".flac"):
|
||||
process_chunk(filename)
|
||||
|
||||
|
|
Loading…
Reference in a new issue