added default volume
This commit is contained in:
1 parent
c552b3e4b1
commit
e8be3e0919
2 files changed
+11
-9
No files matched your search
+3
-2
@@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
[extract]
|
[extract]
|
||||||
# Input files — relative to repo root or absolute. Same as extract.py inputs.
|
# Input files — relative to repo root or absolute. Same as extract.py inputs.
|
||||||
file_a = "/path/to/movie_b.mp4"
|
file_a = "/path/to/movie_a.mkv"
|
||||||
file_b = "/path/to/movie_a.mkv"
|
file_b = "/path/to/movie_b.mp4"
|
||||||
# Window to extract (seconds). This is the ONLY duration needed.
|
# Window to extract (seconds). This is the ONLY duration needed.
|
||||||
duration = 30
|
duration = 30
|
||||||
# Start offset in file (seconds, 0 = file start). ffmpeg -ss before -i for fast seek.
|
# Start offset in file (seconds, 0 = file start). ffmpeg -ss before -i for fast seek.
|
||||||
@@ -27,6 +27,7 @@ target_tp = -1.0 # true peak limit (dBTP)
|
|||||||
target_lra = 11 # loudness range
|
target_lra = 11 # loudness range
|
||||||
# Audio stream selection: null = prompt interactively, int = use that index, "skip" = no audio
|
# Audio stream selection: null = prompt interactively, int = use that index, "skip" = no audio
|
||||||
# stream = null
|
# stream = null
|
||||||
|
volume = 10 # the default volume in ast
|
||||||
|
|
||||||
[sync]
|
[sync]
|
||||||
# Analysis window: null = use full extracted duration; otherwise limit for quick test
|
# Analysis window: null = use full extracted duration; otherwise limit for quick test
|
||||||
|
|||||||
+8
-7
@@ -79,11 +79,12 @@ def decimate_with_peak(arr: np.ndarray, peak_idx: int, max_pts: int = 200_000) -
|
|||||||
return out, idx_out
|
return out, idx_out
|
||||||
|
|
||||||
|
|
||||||
def find_wavs_from_config(cfg: dict) -> tuple[str, str, int, float, float]:
|
def find_wavs_from_config(cfg: dict) -> tuple[str, str, int, float, float, int]:
|
||||||
audio_cfg = cfg.get("audio", {})
|
audio_cfg = cfg.get("audio", {})
|
||||||
extract_cfg = cfg.get("extract", {})
|
extract_cfg = cfg.get("extract", {})
|
||||||
sync_cfg = cfg.get("sync", {})
|
sync_cfg = cfg.get("sync", {})
|
||||||
sr = int(audio_cfg.get("sample_rate", 48000))
|
sr = int(audio_cfg.get("sample_rate", 48000))
|
||||||
|
volume = int(audio_cfg.get("volume"))
|
||||||
# priority: explicit wav paths else derived from extracted dir
|
# priority: explicit wav paths else derived from extracted dir
|
||||||
a_wav = audio_cfg.get("file_a_wav")
|
a_wav = audio_cfg.get("file_a_wav")
|
||||||
b_wav = audio_cfg.get("file_b_wav")
|
b_wav = audio_cfg.get("file_b_wav")
|
||||||
@@ -109,12 +110,12 @@ def find_wavs_from_config(cfg: dict) -> tuple[str, str, int, float, float]:
|
|||||||
duration = extract_cfg.get("duration", 90)
|
duration = extract_cfg.get("duration", 90)
|
||||||
start = float(extract_cfg.get("start", 0.0))
|
start = float(extract_cfg.get("start", 0.0))
|
||||||
# duration_sec comment: only duration needed is off the extract — we respect that
|
# duration_sec comment: only duration needed is off the extract — we respect that
|
||||||
return a_wav, b_wav, sr, float(start), float(duration)
|
return a_wav, b_wav, sr, float(start), float(duration), volume
|
||||||
|
|
||||||
|
|
||||||
class SyncWindow(QtWidgets.QMainWindow):
|
class SyncWindow(QtWidgets.QMainWindow):
|
||||||
def __init__(self, a_path: str, b_path: str, sr: int = 48000, method: str = "phat", device: str = "auto",
|
def __init__(self, a_path: str, b_path: str, sr: int = 48000, method: str = "phat", device: str = "auto",
|
||||||
video_a: str = "", video_b: str = "", out_dir: str = "output"):
|
video_a: str = "", video_b: str = "", out_dir: str = "output", volume: int = 30):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.setWindowTitle(f"movie_sync — audio sync test — {device_info()}")
|
self.setWindowTitle(f"movie_sync — audio sync test — {device_info()}")
|
||||||
self.resize(1400, 900)
|
self.resize(1400, 900)
|
||||||
@@ -253,10 +254,10 @@ class SyncWindow(QtWidgets.QMainWindow):
|
|||||||
ctr2.addWidget(QtWidgets.QLabel("Volume:"))
|
ctr2.addWidget(QtWidgets.QLabel("Volume:"))
|
||||||
self.vol = QtWidgets.QSlider(QtCore.Qt.Orientation.Horizontal)
|
self.vol = QtWidgets.QSlider(QtCore.Qt.Orientation.Horizontal)
|
||||||
self.vol.setRange(0, 100)
|
self.vol.setRange(0, 100)
|
||||||
self.vol.setValue(70)
|
self.vol.setValue(volume)
|
||||||
self.vol.setMaximumWidth(200)
|
self.vol.setMaximumWidth(200)
|
||||||
ctr2.addWidget(self.vol)
|
ctr2.addWidget(self.vol)
|
||||||
self.vol_label = QtWidgets.QLabel("70%")
|
self.vol_label = QtWidgets.QLabel(f"{volume}%")
|
||||||
ctr2.addWidget(self.vol_label)
|
ctr2.addWidget(self.vol_label)
|
||||||
|
|
||||||
self.btn_play_a = QtWidgets.QPushButton("Play A")
|
self.btn_play_a = QtWidgets.QPushButton("Play A")
|
||||||
@@ -507,7 +508,7 @@ def main():
|
|||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
|
||||||
cfg = load_config(args.config)
|
cfg = load_config(args.config)
|
||||||
cfg_a, cfg_b, sr, _, _ = find_wavs_from_config(cfg)
|
cfg_a, cfg_b, sr, _, _, volume = find_wavs_from_config(cfg)
|
||||||
a_path = args.a or cfg_a
|
a_path = args.a or cfg_a
|
||||||
b_path = args.b or cfg_b
|
b_path = args.b or cfg_b
|
||||||
method = args.method or cfg.get("sync", {}).get("method", "phat")
|
method = args.method or cfg.get("sync", {}).get("method", "phat")
|
||||||
@@ -554,7 +555,7 @@ def main():
|
|||||||
app.setPalette(dark)
|
app.setPalette(dark)
|
||||||
pg.setConfigOptions(antialias=True, background="#1e1e1e", foreground="#ddd")
|
pg.setConfigOptions(antialias=True, background="#1e1e1e", foreground="#ddd")
|
||||||
w = SyncWindow(a_path, b_path, sr=sr, method=method, device=device,
|
w = SyncWindow(a_path, b_path, sr=sr, method=method, device=device,
|
||||||
video_a=video_a, video_b=video_b, out_dir=out_dir)
|
video_a=video_a, video_b=video_b, out_dir=out_dir, volume=volume)
|
||||||
w.show()
|
w.show()
|
||||||
sys.exit(app.exec())
|
sys.exit(app.exec())
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user