summaryrefslogtreecommitdiff
path: root/src/transforms.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@gmail.com>2016-11-06 20:44:48 +0200
committerJustin Worthe <justin.worthe@gmail.com>2016-11-06 20:44:48 +0200
commitda2a138787797bbae1c1f030a9ddf660d85f08bd (patch)
tree64b4f1654926518f549420e11d2e516e1d33d0d1 /src/transforms.rs
parent75c9880d1a7bb7e54996743989374a45d5a26e49 (diff)
Hooked up printing FFT result to screen
It's wrong, but it's showing it on the GUI. I'm calling it a win.
Diffstat (limited to 'src/transforms.rs')
-rw-r--r--src/transforms.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/transforms.rs b/src/transforms.rs
index 6b491ac..16478df 100644
--- a/src/transforms.rs
+++ b/src/transforms.rs
@@ -51,3 +51,8 @@ fn fft_on_sine_wave() {
assert!(peak.min_freq <= frequency);
assert!(peak.max_freq >= frequency);
}
+
+pub fn hz_to_pitch(hz: f64) -> String {
+ let pitch_number = 49.0 + 12.0 * (hz / 440.0).log2();
+ pitch_number.floor().to_string()
+}