From 9287e222a501c367f1d082a39713f1d407be7bfb Mon Sep 17 00:00:00 2001 From: "Skylar \"The Cobra\" Widulski" Date: Fri, 22 Dec 2023 10:39:58 -0500 Subject: [PATCH] Interpolate non-fft values too Signed-off-by: Skylar "The Cobra" Widulski --- README.md | 2 +- config.example.scm | 2 +- yammer.scm | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4faccd3..e6a0ef0 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Below is a list of values and what they do * `bgcolor`: Background color * `queue-size`: The size of the queue (minimum of 1), delays displaying bars by `queue-size` frames. Useful if desync is noticed * `fft`: Whether or not to perform a fourier transform to show frequencies (like `spectrum` mode in most other visualizers) -* `fft-interpolation`: Number of points to interpolate between fft values. <1 means disable +* `interpolation`: Number of points to interpolate between values. <1 means disable * `smoothing`: Smoothing mode. Possible values are: * `#f`: No smoothing or interpolation. Disregards `fft-interpolation` * `'none`: No smoothing diff --git a/config.example.scm b/config.example.scm index 4fecadb..ed40889 100644 --- a/config.example.scm +++ b/config.example.scm @@ -8,7 +8,7 @@ (define bgcolor #x2e2016ff) (define queue-size 1) (define fft #f) -(define fft-interpolation 0) +(define interpolation 0) (define smoothing-mode 'none) (define moving-average-block-size 25) (define exponential-factor 0.5) diff --git a/yammer.scm b/yammer.scm index ed30bca..efbd9c2 100755 --- a/yammer.scm +++ b/yammer.scm @@ -142,7 +142,7 @@ (define input lst) (define ret '()) (define window 0) - (if (> fft-interpolation 0) + (if (> interpolation 0) ;; Interpolate FFT values (begin (set! input '()) @@ -150,7 +150,7 @@ ((>= (1+ i) (length lst))) (set! input (append input (list (list-ref lst i)))) (do ((j 0 (1+ j))) - ((> j fft-interpolation)) + ((> j interpolation)) (let ((n (- (list-ref lst (1+ i)) (list-ref lst i)))) (set! input (append input (list (* (expt (1+ j) (/ n 100000)) (list-ref lst i)))))))))) @@ -219,7 +219,10 @@ (do-dft plan (map cadr plst) (length plst)))))) ;; No FFT - (draw ren plst)))) + (if (not (equal? smoothing-mode #f)) + (draw ren (map list (smooth (map car plst) smoothing-mode) + (smooth (map cadr plst) smoothing-mode))) + (draw ren plst))))) (touch sleep-future))) ;; Initially open the MPD FIFO