Skip to content

Instantly share code, notes, and snippets.

@illiichi
Last active December 9, 2022 04:27
Show Gist options
  • Save illiichi/b03fc52ace30e986ac17e42f81e47d85 to your computer and use it in GitHub Desktop.
Save illiichi/b03fc52ace30e986ac17e42f81e47d85 to your computer and use it in GitHub Desktop.
(ns llll-works.freeware-compi
(:use [overtone.core]))
(connect-external-server "localhost" 57110)
(defmacro reduce->
[initial f & colls]
`(reduce ~f ~initial (apply map list ~(vec colls))))
(defmacro rotate-> [snd pos]
`(let [[snd1# snd2#] ~snd] (rotate2 snd1# snd2# ~pos)))
(defmacro play [body]
`((synth (out 0 ~body))))
;; dispense
(play (-> (map #(* (sin-osc %1)
(lf-pulse (lin-exp (lf-saw:kr 1/48 %2) -1 1 1/4 2)
0 1/16))
(reductions * 500 (cycle [5/4 4/3 6/5]))
(range 3/2 2 1/24))
splay
(hold 48 0 0)
(* 32 (env-gen (envelope [1 1 0] [(* 3 48) 0] 0)))
free-verb
(rotate-> (sin-osc 1))
tanh))
;; rain in the notebook
(play (-> (map #(* (sin-osc %1)
(env-gen (env-perc 0.08 0.8) %2))
(reductions * 120 (cycle [3/2 4/5 8/5 5/4 5/4]))
(map #(-> (lf-saw:kr 1/32 %)
(lin-lin -1 1 1/16 1)
(round 1/16)
(impulse %)
(hold 60 0 0))
(rotate 12 (range 0 2 1/12))))
splay
(* 15)
tanh))
;; kinoko
(play
(-> (map #(let [gate (hold (impulse (+ 1/16 (* % 1/88)) 1/2) 88 0 0)
freq (+ 10 (demand gate 0
(dseq (concat (repeat % 100) [1 10 20]) INF)))
f-env (env-gen (envelope [2 1 3 8] [0.08 0.5 4] 4) gate)
rq (lin-exp (sin-osc %) -1 1 0.1 0.3)
env (env-gen (envelope [0 1 1 0] [0.05 1 5] -4) gate)]
(* (rlpf (saw freq) (* %2 f-env) rq) env))
(range 1 31 3)
(iterate #(* % 3/2) 100))
splay
(reduce-> #(+ %1 (* (lf-noise2 1/2) (delay-c %1 %2 %2)))
[1/6 1/4 1/2])
(* 8)
tanh))
; Copyright (c) 2022 illiichi (@maeda_)
;
; This program is free software; you can redistribute it and/or
; modify it under the terms of the GNU General Public License
; as published by the Free Software Foundation; either version 2
; of the License, or any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program. If not, see http://www.gnu.org/licenses/.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment