|
11 | 11 | [tech.v3.datatype :as dtype] |
12 | 12 | [clojure.math :as math])) |
13 | 13 |
|
| 14 | +;; ## Exploring a violin Tremolo |
| 15 | + |
| 16 | +;; ## Relevant community projects |
| 17 | + |
| 18 | +;; {width=100} |
| 19 | + |
| 20 | +;; [DSP Study group](https://scicloj.github.io/docs/community/groups/dsp-study/) |
| 21 | + |
| 22 | +;; [Clojure Jam 2026](https://scicloj.github.io/clojure-jam-2026/) |
| 23 | + |
14 | 24 | ;; ## Data source |
15 | 25 | ;; |
16 | 26 | ;; [violin tremolo G#2.aif](https://freesound.org/people/ldk1609/sounds/56085/) |
|
28 | 38 | (require '[babashka.fs :as fs]) |
29 | 39 |
|
30 | 40 | (def violin-file-path |
31 | | - (fs/file (fs/parent *file*) |
| 41 | + (fs/file "src/clojure_norway/meetup_2025_12/" |
32 | 42 | violin-file-name)) |
33 | 43 |
|
34 | 44 | ;; ## Listening to the file |
35 | 45 |
|
36 | 46 | (kind/audio |
37 | 47 | {:src violin-file-name}) |
38 | 48 |
|
39 | | -(kind/audio |
40 | | - {:src (str "clojure_norway/meetup_2025_12/" violin-file-name)}) |
41 | | - |
42 | 49 | ;; ## Reading the Wav file as data |
43 | 50 |
|
44 | 51 | ;; [Reading WAV files](https://clojurecivitas.github.io/dsp/wav_files.html). |
@@ -136,7 +143,7 @@ wav-ds |
136 | 143 | (apply concat)) |
137 | 144 | :sample-rate sample-rate} |
138 | 145 |
|
139 | | -;; ## Computing the Discrete Fouried Transform the data |
| 146 | +;; ## Computing the Discrete Fouriee Transform the data |
140 | 147 |
|
141 | 148 | (import 'com.github.psambit9791.jdsp.transform.DiscreteFourier) |
142 | 149 |
|
@@ -194,6 +201,23 @@ wav-ds |
194 | 201 | (tc/head 20)) |
195 | 202 |
|
196 | 203 |
|
| 204 | +;; ## Variation in time |
| 205 | + |
| 206 | +;; > After a few minutes in a restaurant we cease to notice the annoying |
| 207 | +;; > hubbub of surrounding conversations but a sudden silence reminds |
| 208 | +;; > us of the presence of neighbors Our attention is clearly attracted by |
| 209 | +;; > transients and movements as opposed to stationary stimuli which we |
| 210 | +;; > soon ignore Concentrating on transients is probably a strategy for |
| 211 | +;; > selecting important information from the overwhelming amount of data |
| 212 | +;; > recorded by our senses Yet classical signal processing has devoted |
| 213 | +;; > most of its e orts to the design of time invariant and space invariant |
| 214 | +;; > operators that modify stationary signal properties This has led to the |
| 215 | +;; > indisputable hegemony of the Fourier transform but leaves aside many |
| 216 | +;; > information processing applications |
| 217 | + |
| 218 | +;; St´ephane Mallat, [A Wavelet Tour of Signal Processing](https://coehuman.uodiyala.edu.iq/uploads/Coehuman%20library%20pdf/%D9%83%D8%AA%D8%A8%20%D8%A7%D9%84%D8%B1%D9%8A%D8%A7%D8%B6%D9%8A%D8%A7%D8%AA%20Mathematics%20books/Wavelets/Mallat_Wavelet-Tour-of-Signal-Processing.pdf) |
| 219 | + |
| 220 | +;; ## DFT of a piece of data |
197 | 221 |
|
198 | 222 | (def some-dft-ds |
199 | 223 | (values->dft-ds |
@@ -249,11 +273,6 @@ wav-ds |
249 | 273 | (into {:time time}) |
250 | 274 | tc/dataset))) |
251 | 275 |
|
252 | | -(-> some-dft-ds |
253 | | - (dft-ds->peaks-ds {:n-peaks 10}) |
254 | | - (peaks-ds->components-ds {:duration 1}) |
255 | | - (tc/head 500)) |
256 | | - |
257 | 276 | (-> some-dft-ds |
258 | 277 | (dft-ds->peaks-ds {:n-peaks 10}) |
259 | 278 | (peaks-ds->components-ds {:duration 1}) |
@@ -423,4 +442,3 @@ wav-ds |
423 | 442 | (apply tc/concat)) |
424 | 443 | :combined |
425 | 444 | audio) |
426 | | - |
|
0 commit comments