Skip to content

Commit 072d248

Browse files
committed
tools: analyze-wav.py: Increase coverage threshold
Increase the coverage threshold for detecting audio glitches. The threshold defines how many frequencies need to be "active" to mark a point as a glitch. The increase of the parameter decreases a chance for a false positive where the spectrogram is "blurry", but doesn't contain glitches. Signed-off-by: Pawel Langowski <pawelx.langowski@intel.com>
1 parent 17253b3 commit 072d248

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/analyze-wav.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def detect_vertical_lines(wav_file):
5050
dtype = get_dtype(info.subtype.lower())
5151

5252
data, sr = sf.read(wav_file, dtype=dtype)
53+
print(f"Sample rate: {sr}")
5354
if data.ndim > 1:
5455
data = data[:, 0]
5556
# Remove silence at the beginning and end
@@ -85,7 +86,7 @@ def detect_vertical_lines(wav_file):
8586
# If the normalised frequency is greater than the threshold, mark it as active.
8687
active_freqs = Sxx_norm > freq_threshold
8788
coverage = np.sum(active_freqs, axis=0) / active_freqs.shape[0]
88-
coverage_threshold = 0.8
89+
coverage_threshold = 0.95
8990
# If coverage exceeds threshold, mark as vertical line.
9091
vertical_lines = np.where(coverage > coverage_threshold)[0]
9192
print(f"Detected possible glitches at time indices: {vertical_lines + trim_samples + non_silent[0]}")

0 commit comments

Comments
 (0)