Compare commits
2 Commits
8ce6e20fe8
...
63c3ef1135
Author | SHA1 | Date |
---|---|---|
Skylar "The Cobra" Widulski | 63c3ef1135 | |
Skylar "The Cobra" Widulski | e8aa120b31 |
|
@ -1,3 +1,4 @@
|
|||
compile.sh
|
||||
libyammer.so
|
||||
config.scm
|
||||
*.swp
|
||||
|
|
|
@ -24,8 +24,10 @@ 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)
|
||||
* `smoothing`: Not implemented
|
||||
* `smoothing-factor`: Not implemented
|
||||
* `smoothing`: Smoothing mode. Possible values are:
|
||||
* `#f`: No smoothing
|
||||
* `moving-average`: Moving average
|
||||
* `moving-average-block-size`: Size of the moving average window. Higher is smoother.
|
||||
|
||||
# Running
|
||||
Either install libyammer.so and yammer.h to their respective systemwide locations, or do the following:
|
||||
|
@ -40,7 +42,7 @@ guile -L . yammer.scm
|
|||
|
||||
# Wishlist
|
||||
* Native PulseAudio and PipeWire sources
|
||||
* Smoothing
|
||||
* More smoothing modes
|
||||
* Average over `resolution`
|
||||
* Offload some calculations to the GPU
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
(define bgcolor #x2e2016ff)
|
||||
(define queue-size 1)
|
||||
(define fft #f)
|
||||
(define smoothing #f)
|
||||
(define smoothing-factor 1.0)
|
||||
(define smoothing-mode 'moving-average)
|
||||
(define moving-average-block-size 25)
|
||||
|
|
31
yammer.scm
31
yammer.scm
|
@ -38,6 +38,7 @@
|
|||
#:use-module (yammer fftw))
|
||||
|
||||
(add-to-load-path ".")
|
||||
|
||||
(load "config.scm")
|
||||
(define recip-fps (/ 1 fps))
|
||||
(define sample-size (* 4 (round (* 3 (* (/ 44100 4) recip-fps)))))
|
||||
|
@ -90,7 +91,7 @@
|
|||
(delete-surface! init-surf)
|
||||
(fill-rect surf #nil color)
|
||||
(let ((y-mid (round/ y 2)))
|
||||
(do ((i 0 (+ i (/ x (length plst))))
|
||||
(do ((i 0 (+ i (* (/ x (length plst)) resolution)))
|
||||
(j 0 (1+ j)))
|
||||
((>= j (length plst)))
|
||||
(begin
|
||||
|
@ -98,7 +99,7 @@
|
|||
surf
|
||||
(make-rect
|
||||
(floor i) 0
|
||||
(ceiling/ x (length plst))
|
||||
(* (ceiling/ x (length plst)) resolution)
|
||||
(- y-mid (abs (round/ (* y (car (list-ref plst j)))
|
||||
(/ 76800 scale)))))
|
||||
bgcolor)
|
||||
|
@ -108,7 +109,7 @@
|
|||
surf
|
||||
(make-rect
|
||||
(floor i) (+ y-mid n)
|
||||
(ceiling/ x (length plst))
|
||||
(* (ceiling/ x (length plst)) resolution)
|
||||
(- y-mid n))
|
||||
bgcolor))))))
|
||||
(define texture (surface->texture ren surf))
|
||||
|
@ -117,8 +118,20 @@
|
|||
(delete-texture! texture)
|
||||
(delete-surface! surf))
|
||||
|
||||
(define (smooth lst)
|
||||
lst)
|
||||
(define (smooth lst type)
|
||||
(define ret '())
|
||||
(define window 0)
|
||||
(cond
|
||||
((eq? type 'moving-average)
|
||||
(do ((i 1 (1+ i)))
|
||||
((>= i (- (length lst) moving-average-block-size)))
|
||||
(set! window (list-ref lst (- i 1)))
|
||||
(do ((j 0 (1+ j)))
|
||||
((>= j moving-average-block-size))
|
||||
(set! window (+ window (list-ref lst (+ i j)))))
|
||||
(set! window (round/ window moving-average-block-size))
|
||||
(set! ret (append ret (list window))))))
|
||||
ret)
|
||||
|
||||
(define (lp ren fft?)
|
||||
(define read-future #f)
|
||||
|
@ -132,15 +145,17 @@
|
|||
bv (native-endianness) 2)))
|
||||
(set! read-future (future (read-fifo fd)))
|
||||
(if fft?
|
||||
(if smoothing
|
||||
(if (not (equal? smoothing-mode #f))
|
||||
(draw ren
|
||||
(map list
|
||||
(smooth (s16vector->list
|
||||
(do-dft plan (map car plst)
|
||||
(length plst))))
|
||||
(length plst)))
|
||||
smoothing-mode)
|
||||
(smooth (s16vector->list
|
||||
(do-dft plan (map cadr plst)
|
||||
(length plst))))))
|
||||
(length plst)))
|
||||
smoothing-mode)))
|
||||
(draw ren
|
||||
(map list
|
||||
(s16vector->list
|
||||
|
|
Loading…
Reference in New Issue