summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorequa <equaa@protonmail.com>2021-04-23 14:10:37 -0500
committerequa <equaa@protonmail.com>2021-04-23 14:10:37 -0500
commit465b2e11a689526c7a830bb50483dc772d359f84 (patch)
treef2c3fb49a8248ce552a95391336eeae0a5eaaedd /lib
parent5473d5d303b55b06438d65c4b3abd2fc0b0f86fc (diff)
minor music adjustments
Diffstat (limited to 'lib')
-rw-r--r--lib/music.fnl17
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/music.fnl b/lib/music.fnl
index 434855b..d19a269 100644
--- a/lib/music.fnl
+++ b/lib/music.fnl
@@ -10,13 +10,13 @@
   (tset s.voices n (% (+ (. s.voices n) (/ freq sample-rate)) 1))
   (if (= s.screen :game)
       (math.max -1 (math.min 1 (* (math.sin (* math.pi 2 (. s.voices n))) 2)))
-      (math.max -1 (math.min 1 (* (math.sin (* math.pi 2 (math.min 0.3 (. s.voices n)))) 1)))))
+      (math.max -1 (math.min 1 (* (math.sin (* math.pi 2 (math.min 0.2 (. s.voices n)))) 1)))))
 
 (fn fill [buffer n]
   (set s.alive* (+ s.alive* (* 0.03 (- s.alive s.alive*))))
-  (when (= (math.random 0 30) 0)
+  (when (= (math.random 0 35) 0)
     ;; (print s.t)
-    (local index (math.random 3 31))
+    (local index (math.random 3 23))
     (tset s.rhythms index (math.random 3 8))
     (tset s.freqs index (* (. s.freqs (- index 1))
                            (. [1 1.2 1.2 1.2 1.5 1.5 1.2 (/ 4 3) 1.75 2]
@@ -24,12 +24,13 @@
   (for [x 0 (- n 1)]
     (for [side 1 2]
       (var total 0)
-      (for [z 0 15]
+      (for [z 0 11]
         (local vn (+ (* z 2) side -1))
         (set total
              (+ total
                 (* (osc vn (* (math.max 0.6 (or s.speed 0)) (/ 0.6) (. s.freqs vn)))
                    (if (< vn (+ (/ s.alive* 23) 1)) 1 0)
+                   (if (> (. s.freqs vn) 1000) 0.3 1)
                    0.04
                    (math.max 0
                              (- 1 (* 0.00005
@@ -49,17 +50,15 @@
   (set s.alive* 0)
   (set s.ring {})
   (set s.ring-index 1)
-  (set s.voices (do (var t []) (for [i 0 31] (tset t i 0)) t))
+  (set s.voices (do (var t []) (for [i 0 23] (tset t i 0)) t))
   (set s.freqs (do (var t [])
-                 (for [i 0 31]
+                 (for [i 0 23]
                    (tset t i (* 110 (^ 1.2 (math.floor (/ i 2))))))
                  t))
   (set s.rhythms (do (var t [])
-                   (for [i 0 31] (tset t i (if (< i 2) 8 (< i 4) 6
+                   (for [i 0 23] (tset t i (if (< i 2) 8 (< i 4) 6
                                                (+ (/ i 2) 8))))
                    t))
-  (set s.volumes (do (var t []) (for [i 0 31]
-                                  (tset t i (if (< i 6) 1 0))) t))
   (set s.source (love.audio.newQueueableSource
                   sample-rate
                   bit-depth