|
9 | 9 | advanced processing. |
10 | 10 | """ |
11 | 11 |
|
12 | | -import json |
13 | 12 | import logging |
14 | 13 | import os |
15 | 14 | import subprocess |
16 | 15 | import tempfile |
17 | | -from dataclasses import asdict, dataclass, field |
18 | | -from typing import Callable, Dict, List, Optional |
| 16 | +from dataclasses import asdict, dataclass |
| 17 | +from typing import Callable, List, Optional |
19 | 18 |
|
20 | | -from opencut.helpers import get_ffmpeg_path, get_ffprobe_path, get_video_info, output_path, run_ffmpeg |
| 19 | +from opencut.helpers import get_ffmpeg_path, get_video_info, output_path, run_ffmpeg |
21 | 20 |
|
22 | 21 | logger = logging.getLogger("opencut") |
23 | 22 |
|
@@ -63,7 +62,6 @@ def _diarize_simple(input_path: str, num_speakers: int = 2) -> List[SpeakerSegme |
63 | 62 | result = subprocess.run(cmd, capture_output=True, text=True, timeout=300, check=False) |
64 | 63 |
|
65 | 64 | segments = [] |
66 | | - speech_start = 0.0 |
67 | 65 | speaker_idx = 0 |
68 | 66 | current_start = 0.0 |
69 | 67 |
|
@@ -142,7 +140,6 @@ def _pitch_shift_segment( |
142 | 140 |
|
143 | 141 | # Use asetrate + atempo for simple pitch shift |
144 | 142 | # Raising pitch by semitones: rate_factor = 2^(semitones/12) |
145 | | - import math |
146 | 143 | rate_factor = 2 ** (semitones / 12.0) |
147 | 144 | tempo_factor = 1.0 / rate_factor # compensate to keep duration |
148 | 145 |
|
@@ -270,7 +267,6 @@ def anonymize_speaker( |
270 | 267 | try: |
271 | 268 | # Create pitch-shifted version of full audio |
272 | 269 | shifted_path = os.path.join(tmpdir, "shifted.wav") |
273 | | - import math |
274 | 270 | rate_factor = 2 ** (pitch_semitones / 12.0) |
275 | 271 | tempo_factor = 1.0 / rate_factor |
276 | 272 |
|
|
0 commit comments