@@ -226,6 +226,9 @@ wav-format
226226 (plotly/layer-line {:=x :freq
227227 :=y :power }))
228228
229+ (-> cosine-wave-dft-ds
230+ (tc/head 20 ))
231+
229232; ; ## Modelling actual data
230233
231234; ; > To enjoy bodily warmth, some small part of you must be cold,
@@ -322,7 +325,11 @@ wav-format
322325 (plotly/layer-line {:=x :time
323326 :=y :combined }))
324327
325-
328+ (defn audio [samples]
329+ (with-meta
330+ {:samples samples
331+ :sample-rate sample-rate}
332+ {:kind/audio true }))
326333
327334(-> (some-part 1 1.05 )
328335 audio)
@@ -455,38 +462,39 @@ wav-format
455462 c)))
456463 bufimg/tensor->image)
457464
458-
459-
460-
461-
462-
463-
464- (defn animated-echarts [{:as details
465- :keys [specs time-for-transition]}]
465+ (defn animated-echarts [specs]
466466 (kind/reagent
467- ['(fn [{:keys [specs
468- time-for-transition]}]
467+ ['(fn [specs]
469468 (let [*i (reagent.core/atom 0 )]
470469 (fn []
471470 ^{:key @*i}
472471 [:div
473- [:p (pr-str (rem @*i (count specs)))]
474472 [:div {:style {:height " 400px" }
475473 :ref (fn [el]
476474 (when el
477475 (let [chart (.init js/echarts el)]
478476 (.setOption chart
479477 (clj->js
480478 (specs (rem @*i (count specs))))))))}]
481- (js/setInterval #(swap! *i inc) time-for-transition )
479+ (js/setInterval #(swap! *i inc) 1000 )
482480 ; ; Include this to force component update:
483- [:p {:style {:display :none }}
484- (hash @*i)]
485- ])))
486- details]
481+ [:p {:display :none }
482+ (hash @*i)]])))
483+ specs]
487484 {:html/deps [:echarts ]}))
488485
489-
486+ (let [n 100 ]
487+ (-> normalized-spectrogram
488+ (tensor/transpose [1 0 ])
489+ (tensor/slice 1 )
490+ (->> (take 20 )
491+ (mapv (fn [spectrum]
492+ {:xAxis {:show false
493+ :data (vec (range 100 ))}
494+ :yAxis {:show false }
495+ :series [{:type " line"
496+ :data (vec (take 100 spectrum))}]}))
497+ animated-echarts)))
490498
491499
492500
0 commit comments