summaryrefslogtreecommitdiff
path: root/src/transforms.rs
diff options
context:
space:
mode:
authorJustin Worthe <justin.worthe@gmail.com>2017-04-18 21:30:06 +0200
committerJustin Worthe <justin.worthe@gmail.com>2017-04-18 21:30:06 +0200
commit15f2b84c46cc81199f76643af2d030d2ab768601 (patch)
treee3df761c5c114789de11884e982e28023e3a5b80 /src/transforms.rs
parentd9c2952c36f272faba767081bf4c96cc4aa868e2 (diff)
Added basic oscilloscope functionality to watch the waveform
The triggering algorithm isn't great at the moment. Seems the interesting signals end up crossing zero a few times. I need to take things like maxima into account as well. I'm also running out of vertical space. I need to start making the GUI a bit smarter, and allow turning some of these graphs on/off at runtime.
Diffstat (limited to 'src/transforms.rs')
-rw-r--r--src/transforms.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/transforms.rs b/src/transforms.rs
index 0ff3e17..72aad8a 100644
--- a/src/transforms.rs
+++ b/src/transforms.rs
@@ -227,3 +227,12 @@ fn c4_is_correct() {
fn f5_is_correct() {
assert_eq!(hz_to_pitch(698.46), "F5 +0");
}
+
+
+pub fn align_to_rising_edge(samples: &Vec<f64>) -> Vec<f64> {
+ samples.iter()
+ .skip_while(|x| !x.is_sign_negative())
+ .skip_while(|x| x.is_sign_negative())
+ .cloned()
+ .collect()
+}