1- ; ; # Nowway Clojure Meetup Dec 2025: Modeling a Violin Tremolo
1+ ; ; # Noway Clojure Meetup Dec 2025: Modeling a Violin Tremolo
22
33(ns clojure-norway.meetup-2025-12.violin
44 (:require [scicloj.kindly.v4.kind :as kind]
@@ -167,11 +167,11 @@ wav-format
167167 (apply concat))
168168 :sample-rate sample-rate}
169169
170- ; ; ## Modelling a simple wave
170+ ; ; ## A simple wave
171171
172172(def cosine-wave
173173 (-> {:time (-> (range 0
174- 0.1
174+ 10
175175 (/ 1.0 sample-rate)))}
176176 tc/dataset
177177 (tc/add-column :value #(-> %
@@ -181,9 +181,11 @@ wav-format
181181 dfn/cos))))
182182
183183(-> cosine-wave
184+ (tc/select-rows #(<= (:time %) 0.1 ))
184185 (plotly/layer-line {:=x :time
185186 :=y :value }))
186187
188+ ; ; ## Discrete Fourier Transform
187189
188190(import 'com.github.psambit9791.jdsp.transform.DiscreteFourier)
189191
@@ -220,16 +222,13 @@ wav-format
220222 (plotly/layer-line {:=x :freq
221223 :=y :power }))
222224
223- (-> cosine-wave-dft-ds
224- (tc/head 20 ))
225-
226- ; ; ## Actual data
225+ ; ; ## Modelling actual data
227226
228227; ; > To enjoy bodily warmth, some small part of you must be cold,
229228; ; > for there is no quality in this world that is not what it is merely by contrast.
230229; ; > Nothing exists in itself.
231230
232- [Herman Melville](https://www.goodreads.com/quotes/533392-to-enjoy-bodily-warmth-some-small-part-of-you-must ), Moby-Dick
231+ ; ; [Herman Melville](https://www.goodreads.com/quotes/533392-to-enjoy-bodily-warmth-some-small-part-of-you-must), Moby-Dick
233232
234233; ; ## DFT of a piece of data
235234
@@ -319,11 +318,7 @@ wav-format
319318 (plotly/layer-line {:=x :time
320319 :=y :combined }))
321320
322- (defn audio [samples]
323- (with-meta
324- {:samples samples
325- :sample-rate sample-rate}
326- {:kind/audio true }))
321+
327322
328323(-> (some-part 1 1.05 )
329324 audio)
@@ -476,3 +471,8 @@ wav-format
476471
477472; ; [Pema Chodron](https://www.awakin.org/v2/read/view.php?tid=2436), When Things Fall Apart
478473
474+ ^kind/audio
475+ {:samples wav-samples
476+ :sample-rate sample-rate}
477+
478+
0 commit comments