Add clap detection sensitivity settings (Tools menu)
Threshold and min-interval (the librosa delta/wait knobs) were only ever tunable via the CLI's -t/-m flags. Added a Clap Detection Settings dialog (Tools menu) with both as spin boxes, an explicit Reset to Defaults button, and Cancel that leaves MainWindow's current settings untouched. Exposed DEFAULT_THRESHOLD=0.7/DEFAULT_MIN_INTERVAL=0.3 as named constants in clap_detection.py so the CLI script, DetectWorker's defaults, and the dialog's reset button all reference the same source of truth instead of three copies of the same magic numbers that could drift apart.
This commit is contained in:
@@ -11,7 +11,7 @@ from datetime import timedelta
|
||||
from pathlib import Path
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
from clap_detection import detect_claps, ClapDetectionUnavailable
|
||||
from clap_detection import detect_claps, ClapDetectionUnavailable, DEFAULT_THRESHOLD, DEFAULT_MIN_INTERVAL
|
||||
|
||||
|
||||
def format_timestamp(seconds):
|
||||
@@ -43,10 +43,10 @@ Threshold guide:
|
||||
)
|
||||
|
||||
parser.add_argument('input_file', help='Audio or video file')
|
||||
parser.add_argument('-t', '--threshold', type=float, default=0.7,
|
||||
help='Detection threshold (0-1, default: 0.7, higher = less sensitive)')
|
||||
parser.add_argument('-m', '--min-interval', type=float, default=0.3,
|
||||
help='Minimum seconds between detections (default: 0.3)')
|
||||
parser.add_argument('-t', '--threshold', type=float, default=DEFAULT_THRESHOLD,
|
||||
help=f'Detection threshold (0-1, default: {DEFAULT_THRESHOLD}, higher = less sensitive)')
|
||||
parser.add_argument('-m', '--min-interval', type=float, default=DEFAULT_MIN_INTERVAL,
|
||||
help=f'Minimum seconds between detections (default: {DEFAULT_MIN_INTERVAL})')
|
||||
parser.add_argument('-s', '--show-strength', action='store_true',
|
||||
help='Show onset strength values')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user