Created
October 19, 2023 04:33
-
-
Save fauxneticien/34d0bfc675d40207c39f7d9412d7543f to your computer and use it in GitHub Desktop.
A solution for Colab exercise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def signal2int(signal, sample_rate=16_000, seq_length=4): | |
""" | |
Decode a sine wave signal back into digits | |
""" | |
digits = [] | |
for start_index in range(0, sample_rate * seq_length, sample_rate): | |
end_index = start_index + sample_rate - 1 | |
window_samples = signal[start_index:end_index] | |
window_pitch = extract_pitch(window_samples) | |
window_digit = int(window_pitch/100 - 1) | |
digits.append(window_digit) | |
return digits |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment