Sync source edition with VCC Plus 3.7.0 build 63
This commit is contained in:
1 parent
c652a5276d
commit
b2ecec4d87
86 files changed
+10519
-472
No files matched your search
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Reproduce short host-only cues from the retained CC0 Freesound previews.
|
||||
|
||||
Requires ffmpeg; not needed to build or run VCC Plus.
|
||||
"""
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
import json
|
||||
import struct
|
||||
import subprocess
|
||||
import wave
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[3]
|
||||
HERE = Path(__file__).resolve().parent
|
||||
DEST = ROOT / "platforms/macos/Resources/CaptureSounds"
|
||||
CLIPS = [("shutter.mp3", "screenshot.wav", None),
|
||||
("tape-start.mp3", "recording-start.wav", "atrim=start=1.62:end=2.14,asetpts=PTS-STARTPTS")]
|
||||
|
||||
|
||||
def build():
|
||||
DEST.mkdir(parents=True, exist_ok=True)
|
||||
for original, filename, trim in CLIPS:
|
||||
command = ["ffmpeg", "-nostdin", "-v", "error", "-i", str(HERE / "source" / original)]
|
||||
if trim:
|
||||
command += ["-af", trim]
|
||||
raw = subprocess.check_output(command + ["-ac", "1", "-ar", "44100", "-f", "f32le", "-"])
|
||||
values = struct.unpack("<" + "f" * (len(raw) // 4), raw)
|
||||
peak = max(abs(v) for v in values)
|
||||
scale = 0.35 / max(peak, 0.000001)
|
||||
fade = 221
|
||||
samples = [round(v * scale * 32767 * min(1, i / fade, (len(values) - 1 - i) / fade))
|
||||
for i, v in enumerate(values)]
|
||||
with wave.open(str(DEST / filename), "wb") as output:
|
||||
output.setparams((1, 2, 44100, 0, "NONE", "not compressed"))
|
||||
output.writeframes(struct.pack("<" + "h" * len(samples), *samples))
|
||||
print(filename, len(samples) / 44100, hashlib.sha256((DEST / filename).read_bytes()).hexdigest())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
build()
|
||||
Reference in new issue
Block a user