// Locate the first sample of greatest absolute magnitude, preserving the index for waveform annotation. Empty input returns minus one. pub fn peak_sample_index(samples: vector) -> i64 { if len(samples)==0 { return -1; } let mut best = 0; let mut i = 1; while ib*b { best = i; } i += 1; } best }