forked from cgvr/DeltaVR
professor says good job after first config done
This commit is contained in:
@@ -6,9 +6,17 @@ import numpy as np
|
||||
FRAME_DURATION = 0.02 # 20 ms windows
|
||||
GAIN = 1.0 # multiply RMS values (set to e.g. 30.0 if you want larger values)
|
||||
EXTENSION = ".txt" # output file extension
|
||||
OVERWRITE = False # set True to regenerate even if .txt exists
|
||||
|
||||
|
||||
def process_wav(filepath):
|
||||
# Compute output path first (so we can decide whether to skip)
|
||||
out_path = os.path.splitext(filepath)[0] + EXTENSION
|
||||
|
||||
if not OVERWRITE and os.path.exists(out_path):
|
||||
print(f"Skipping (already exists): {out_path}")
|
||||
return
|
||||
|
||||
print(f"Processing: {filepath}")
|
||||
|
||||
# Load audio
|
||||
@@ -29,7 +37,6 @@ def process_wav(filepath):
|
||||
rms = rms * GAIN
|
||||
|
||||
# Save to .txt
|
||||
out_path = os.path.splitext(filepath)[0] + EXTENSION
|
||||
np.savetxt(out_path, rms, fmt="%.8f")
|
||||
|
||||
print(f"Saved RMS → {out_path}")
|
||||
@@ -49,4 +56,4 @@ def process_folder(folder_path):
|
||||
# === Run script ===
|
||||
if __name__ == "__main__":
|
||||
folder = input("Enter folder path: ").strip()
|
||||
process_folder(folder)
|
||||
process_folder(folder)
|
||||
|
||||
Reference in New Issue
Block a user