From 3b4617893bf74475f9593138385d6da8982dcd63 Mon Sep 17 00:00:00 2001 From: Joseph Wilk Date: Mon, 13 Mar 2017 22:10:56 +0000 Subject: [PATCH] preparing for algofive --- animations/algo.el | 141 +++++++++++++++++++++++++++++++++ animations/end-of-buffer.el | 2 +- init.el | 14 +++- snippets/sonic-pi-mode/at | 8 ++ snippets/sonic-pi-mode/berry | 3 + snippets/sonic-pi-mode/chip | 3 + snippets/sonic-pi-mode/fxsp | 5 ++ snippets/sonic-pi-mode/gpa | 5 ++ snippets/sonic-pi-mode/hrt | 3 + snippets/sonic-pi-mode/knit | 3 + snippets/sonic-pi-mode/line | 3 + snippets/sonic-pi-mode/ll | 10 ++- snippets/sonic-pi-mode/lls | 11 ++- snippets/sonic-pi-mode/ring | 3 + snippets/sonic-pi-mode/rmp | 3 + snippets/sonic-pi-mode/skull | 3 + snippets/sonic-pi-mode/smp | 2 +- snippets/sonic-pi-mode/smppan | 3 + snippets/sonic-pi-mode/spd | 5 ++ snippets/sonic-pi-mode/spread | 5 -- snippets/sonic-pi-mode/spreadw | 3 + 21 files changed, 223 insertions(+), 15 deletions(-) create mode 100644 animations/algo.el create mode 100644 snippets/sonic-pi-mode/at create mode 100644 snippets/sonic-pi-mode/berry create mode 100644 snippets/sonic-pi-mode/chip create mode 100644 snippets/sonic-pi-mode/fxsp create mode 100644 snippets/sonic-pi-mode/gpa create mode 100644 snippets/sonic-pi-mode/hrt create mode 100644 snippets/sonic-pi-mode/knit create mode 100644 snippets/sonic-pi-mode/line create mode 100644 snippets/sonic-pi-mode/ring create mode 100644 snippets/sonic-pi-mode/rmp create mode 100644 snippets/sonic-pi-mode/skull create mode 100644 snippets/sonic-pi-mode/smppan create mode 100644 snippets/sonic-pi-mode/spd delete mode 100644 snippets/sonic-pi-mode/spread create mode 100644 snippets/sonic-pi-mode/spreadw diff --git a/animations/algo.el b/animations/algo.el new file mode 100644 index 0000000..b442960 --- /dev/null +++ b/animations/algo.el @@ -0,0 +1,141 @@ +;;algo by Joseph Wilk +(defvar start-total-count 0) + + +(defun post-zone-algo-animate (c col wend) + (let ((fall-p nil) ; todo: move outward + (o (point)) ; for terminals w/o cursor hiding + (p (point)) + (insert-char (nth 0 `("⟁"))) + (halt-char " ") + (counter 0)) + + (while (< counter 10) + (let ((next-char (char-after p)) + (previous-char (char-after (- p 1)))) + + ;;(progn (forward-line 1) (move-to-column col) (looking-at halt-char)) + ;; (when (< counter 50) (move-to-column (mod counter 150))) + + (when (< (random 100) 50) (move-to-column counter)) + + (setq counter (+ 1 counter)) + (setq total-count (+ 1 total-count)) + + (if (and + ;;(not (looking-at ")")) + ;; (not (looking-at "(")) +;; (not (looking-at "\W")) + (not (looking-at insert-char)) + ;; (not (looking-at "\s")) + ;; (not (looking-at "\w")) + + + ) + (progn + (save-excursion + (dotimes (_ 1) + (delete-char 1) + (insert insert-char) + ) + ;;(goto-char o) + (sit-for 0)) + (if (<= 5 (mod counter 10)) + (setq p (- (point) 1)) + (setq p (+ (point) 1))))))) + fall-p)) + + +(defun zone-algo-animate (c col wend) + (let ((fall-p nil) ; todo: move outward + (o (point)) ; for terminals w/o cursor hiding + (p (point)) + (insert-char (nth 0 `("⟁"))) + (halt-char " ") + (counter 0)) + + (while (< counter 10) + (let ((next-char (char-after p)) + (previous-char (char-after (- p 1)))) + + ;;(progn (forward-line 1) (move-to-column col) (looking-at halt-char)) + ;; (when (< counter 50) (move-to-column (mod counter 150))) + + (when (< (random 100) 50) (move-to-column counter)) + + (setq counter (+ 1 counter)) + (setq total-count (+ 1 total-count)) + + (if (and + ;;(not (looking-at ")")) + ;; (not (looking-at "(")) +;; (not (looking-at "\W")) + (not (looking-at insert-char)) +;; (not (looking-at "\s")) + ;; (not (looking-at "\w")) + + + ) + (progn + (save-excursion + (dotimes (_ 1) + (delete-char 1) + (insert insert-char) + ) + ;;(goto-char o) + (sit-for 0)) + (if (<= 5 (mod counter 10)) + (setq p (- (point) 1)) + (setq p (+ (point) 1))))))) + fall-p)) + +(defun zone-algo () + (set 'truncate-lines nil) + (setq total-count 0) + (let* ((ww (1- (window-width))) + (wh (window-height)) + (mc 0) ; miss count + (total (* ww wh)) + (fall-p nil) + (wend 100) + (wbeg 1) + (counter 0)) + (goto-char (point-min)) + + + (let ((nl (- wh (count-lines (point-min) (point))))) + (when (> nl 0) + (let ((line (concat (make-string (1- ww) ? ) "\n"))) + (do ((i 0 (1+ i))) + ((= i nl)) + ;;(insert line) + )))) + + (catch 'done; ugh + (while (not (input-pending-p)) + (goto-char (point-min)) + (let ((wbeg (window-start)) + (wend (window-end))) + (setq mc 0) + + (goto-char (+ wbeg (random (- wend wbeg)))) + (while (or (looking-at "[\t\n]")) (goto-char (+ wbeg (random (- wend wbeg))))) + ;; character animation sequence + + (setq counter (+ 1 counter)) + + (let ((p (point))) + (goto-char p) + (when (< counter 10000) (zone-algo-animate (zone-cpos p) (current-column) wend)) + (when (and (> counter 4500) (< counter 10000)) + ;;(delete-char 1) + (while (re-search-forward "\\(\s+\\)" nil t 1) + (when (< (random 100) 50) (replace-match "\\1 "))) + ) + + )) + )))) + +(eval-after-load "zone" + '(unless (memq 'zone-algo (append zone-programs nil)) + (setq zone-programs [zone-algo]))) diff --git a/animations/end-of-buffer.el b/animations/end-of-buffer.el index cf40ca5..7339709 100644 --- a/animations/end-of-buffer.el +++ b/animations/end-of-buffer.el @@ -110,4 +110,4 @@ (eval-after-load "zone" '(unless (memq 'zone-end-of-buffer (append zone-programs nil)) - (setq zone-programs [zone-end-of-buffer]))) \ No newline at end of file + (setq zone-programs [zone-end-of-buffer]))) diff --git a/init.el b/init.el index 058b4e5..6d3f85c 100644 --- a/init.el +++ b/init.el @@ -32,7 +32,8 @@ '("~/.live-packs/josephwilk-pack/snippets"))) (yas-reload-all) -(load "~/.live-packs/josephwilk-pack/animations/end-of-buffer.el") +(load "~/.live-packs/josephwilk-pack/animations/algo.el") +;;(load "~/.live-packs/josephwilk-pack/animations/end-of-buffer.el") ;;(load "~/.live-packs/josephwilk-pack/animations/the-stars.el") ;;(load "~/.live-packs/josephwilk-pack/animations/waves.el") ;;(load "~/.live-packs/josephwilk-pack/animations/upcase.el") @@ -169,3 +170,14 @@ middle" ;;Sane reg-builder (require 're-builder) (setq reb-re-syntax 'string) + +(require 'unicode-fonts) +(unicode-fonts-setup) + + +(setq-default show-trailing-whitespace nil) +(setq-default mode-require-final-newline nil) + +(require 'emojify) +(setq emojify-set-emoji-styles 'unicode) +(setq emojify-display-style 'unicode) diff --git a/snippets/sonic-pi-mode/at b/snippets/sonic-pi-mode/at new file mode 100644 index 0000000..603b9e2 --- /dev/null +++ b/snippets/sonic-pi-mode/at @@ -0,0 +1,8 @@ +#name: at +# -- +if spread(1,64).look + at do + sleep 1/8.0*2 + $0 + end +end diff --git a/snippets/sonic-pi-mode/berry b/snippets/sonic-pi-mode/berry new file mode 100644 index 0000000..613e186 --- /dev/null +++ b/snippets/sonic-pi-mode/berry @@ -0,0 +1,3 @@ +# name: stb +# -- +Berry[/sus_oh_p_0$0_rel/,0] \ No newline at end of file diff --git a/snippets/sonic-pi-mode/chip b/snippets/sonic-pi-mode/chip new file mode 100644 index 0000000..a96a1bc --- /dev/null +++ b/snippets/sonic-pi-mode/chip @@ -0,0 +1,3 @@ +#name: chip +# -- +🐿$0 \ No newline at end of file diff --git a/snippets/sonic-pi-mode/fxsp b/snippets/sonic-pi-mode/fxsp new file mode 100644 index 0000000..d544ad5 --- /dev/null +++ b/snippets/sonic-pi-mode/fxsp @@ -0,0 +1,5 @@ +#name: fxsp +# -- +with_fx(spread(${1:in}, ${2:over}).map{|s| s ? ${3:hit} : ${4:miss}}.look) do + $0 +end diff --git a/snippets/sonic-pi-mode/gpa b/snippets/sonic-pi-mode/gpa new file mode 100644 index 0000000..af598ae --- /dev/null +++ b/snippets/sonic-pi-mode/gpa @@ -0,0 +1,5 @@ +#name: gpa +# -- +synth :gpa, note: knit( :Fs4,64, :Cs5,64, + :b4,64, :fs4,64/2.0, :a4, 64/2.0 + ).look, amp: 0.0, attack: 0.001, decay: fslice[:length], release: 0.001 diff --git a/snippets/sonic-pi-mode/hrt b/snippets/sonic-pi-mode/hrt new file mode 100644 index 0000000..5b5a68e --- /dev/null +++ b/snippets/sonic-pi-mode/hrt @@ -0,0 +1,3 @@ +#name: hrt +# -- +♥️$0 diff --git a/snippets/sonic-pi-mode/knit b/snippets/sonic-pi-mode/knit new file mode 100644 index 0000000..92fc001 --- /dev/null +++ b/snippets/sonic-pi-mode/knit @@ -0,0 +1,3 @@ +#name: knit +# -- +(knit $1,$0).look \ No newline at end of file diff --git a/snippets/sonic-pi-mode/line b/snippets/sonic-pi-mode/line new file mode 100644 index 0000000..a7ad38e --- /dev/null +++ b/snippets/sonic-pi-mode/line @@ -0,0 +1,3 @@ +#name: line +# -- +(line $1, $2, $3).look \ No newline at end of file diff --git a/snippets/sonic-pi-mode/ll b/snippets/sonic-pi-mode/ll index 50173ba..20eccbc 100644 --- a/snippets/sonic-pi-mode/ll +++ b/snippets/sonic-pi-mode/ll @@ -1,6 +1,10 @@ #name: ll # -- live_loop :${1:name} do - tick - $0 -end \ No newline at end of file + with_fx :none, mix: 0 do + tick + forever = (knit 1/8.0, 32, 0, 0).look + $0 + sleep forever + end +end diff --git a/snippets/sonic-pi-mode/lls b/snippets/sonic-pi-mode/lls index eb98ba9..90dc113 100644 --- a/snippets/sonic-pi-mode/lls +++ b/snippets/sonic-pi-mode/lls @@ -1,6 +1,9 @@ #name: lls # -- -live_loop :${1:name}, sync: :${2:sname} do - tick - $0 -end \ No newline at end of file +live_loop :${1:name}, sync: algo do + with_fx :none, mix: 0 do + tick + $0 + sleep (1/2.0)*6 + end +end diff --git a/snippets/sonic-pi-mode/ring b/snippets/sonic-pi-mode/ring new file mode 100644 index 0000000..e822b20 --- /dev/null +++ b/snippets/sonic-pi-mode/ring @@ -0,0 +1,3 @@ +#name: ring +# -- +(ring $0).look \ No newline at end of file diff --git a/snippets/sonic-pi-mode/rmp b/snippets/sonic-pi-mode/rmp new file mode 100644 index 0000000..ae7974f --- /dev/null +++ b/snippets/sonic-pi-mode/rmp @@ -0,0 +1,3 @@ +#name: rmp +# -- +(ramp $1, $2, $3).tick(:fire) \ No newline at end of file diff --git a/snippets/sonic-pi-mode/skull b/snippets/sonic-pi-mode/skull new file mode 100644 index 0000000..6bbd157 --- /dev/null +++ b/snippets/sonic-pi-mode/skull @@ -0,0 +1,3 @@ +#name: skull +# -- +☠️$0 diff --git a/snippets/sonic-pi-mode/smp b/snippets/sonic-pi-mode/smp index 3c643ba..d99508b 100644 --- a/snippets/sonic-pi-mode/smp +++ b/snippets/sonic-pi-mode/smp @@ -1,3 +1,3 @@ #name: smp # -- -smp ${1:mod}[/:${2:pat}/,[0,0]].tick(:sample), cutoff: 135, amp: 1.0 +smp ${1:mod}[/${2:pat}/,[0,0]].tick(:sample), cutoff: 135, amp: 1.0, rpitch: (ring 0).look \ No newline at end of file diff --git a/snippets/sonic-pi-mode/smppan b/snippets/sonic-pi-mode/smppan new file mode 100644 index 0000000..1a63259 --- /dev/null +++ b/snippets/sonic-pi-mode/smppan @@ -0,0 +1,3 @@ +# name: smppan +# -- +sample ${1:lib}[[$0]].look, amp: 0.05*1.0, pan: line(-0.25,0.25,256).look \ No newline at end of file diff --git a/snippets/sonic-pi-mode/spd b/snippets/sonic-pi-mode/spd new file mode 100644 index 0000000..6d56691 --- /dev/null +++ b/snippets/sonic-pi-mode/spd @@ -0,0 +1,5 @@ +#name: spd +# -- +if spread($1).look + $0 +end \ No newline at end of file diff --git a/snippets/sonic-pi-mode/spread b/snippets/sonic-pi-mode/spread deleted file mode 100644 index 1647855..0000000 --- a/snippets/sonic-pi-mode/spread +++ /dev/null @@ -1,5 +0,0 @@ -#name: spread -# -- -if spread(1,${1:pat}, rotate: 0).look - $0 -end diff --git a/snippets/sonic-pi-mode/spreadw b/snippets/sonic-pi-mode/spreadw new file mode 100644 index 0000000..270e196 --- /dev/null +++ b/snippets/sonic-pi-mode/spreadw @@ -0,0 +1,3 @@ +#name: spreadw +# -- +$0 = spread(7,11).map{|s| s ? :hit : :miss} \ No newline at end of file