MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / sample_rate_from_times

Function sample_rate_from_times

examples/csv2wav/csv2wav.py:74–84  ·  view source on GitHub ↗
(times)

Source from the content-addressed store, hash-verified

72
73
74def sample_rate_from_times(times):
75 # Derive the capture rate from the Elapsed (s) column so the user does not
76 # have to know it up front. Needs at least two samples and a positive span.
77 if len(times) < 2:
78 return None
79
80 span = times[-1] - times[0]
81 if span <= 0.0:
82 return None
83
84 return int(round((len(times) - 1) / span))
85
86
87def decode_input_to_float(audio, in_format):

Callers 1

convert_csv_to_wavFunction · 0.85

Calls 1

roundFunction · 0.50

Tested by

no test coverage detected