1
0
forked from cgvr/DeltaVR

WIP animate mouth scale based on precalculated voiceline amplitude timelines

This commit is contained in:
2026-02-02 19:15:31 +02:00
parent a0d1ee35cd
commit 5a3f566541
43 changed files with 1475 additions and 70 deletions

View File

@@ -0,0 +1,52 @@
import os
import librosa
import numpy as np
# === CONFIG ===
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
def process_wav(filepath):
print(f"Processing: {filepath}")
# Load audio
audio, sr = librosa.load(filepath, mono=True)
# Frame size in samples
frame_len = int(FRAME_DURATION * sr)
hop_len = frame_len
# Compute RMS
rms = librosa.feature.rms(
y=audio,
frame_length=frame_len,
hop_length=hop_len
)[0]
# Apply optional gain
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}")
def process_folder(folder_path):
print(f"Scanning folder: {folder_path}")
for filename in os.listdir(folder_path):
if filename.lower().endswith(".wav"):
filepath = os.path.join(folder_path, filename)
process_wav(filepath)
print("Done!")
# === Run script ===
if __name__ == "__main__":
folder = input("Enter folder path: ").strip()
process_folder(folder)

View File

@@ -0,0 +1,49 @@
3.170447962475009263e-05
2.923115389421582222e-04
2.510738931596279144e-02
1.111792679876089096e-02
6.692767888307571411e-02
1.006313711404800415e-01
7.780694961547851562e-02
5.686730891466140747e-02
5.614304915070533752e-02
4.554714635014533997e-02
4.514135792851448059e-02
5.479728057980537415e-02
4.272024706006050110e-02
3.989587724208831787e-02
4.298635944724082947e-02
4.074911773204803467e-02
2.244980260729789734e-02
1.105279754847288132e-02
1.347438804805278778e-02
1.654553040862083435e-02
1.846965588629245758e-02
2.045047841966152191e-02
1.407719496637582779e-02
6.578906439244747162e-03
1.353173051029443741e-02
1.625132374465465546e-02
5.863697826862335205e-02
1.110599413514137268e-01
9.950184077024459839e-02
1.184522062540054321e-01
1.000181213021278381e-01
6.772108376026153564e-02
7.621638476848602295e-02
3.018615581095218658e-02
9.624224901199340820e-02
1.259753555059432983e-01
1.276500672101974487e-01
1.206035763025283813e-01
1.011835709214210510e-01
6.155343726277351379e-02
3.734333068132400513e-02
2.485111355781555176e-02
2.122259326279163361e-02
1.139380130916833878e-02
7.472451310604810715e-03
5.807624198496341705e-03
1.960268709808588028e-03
8.761089411564171314e-04
3.071058890782296658e-04