Skip to content

Instantly share code, notes, and snippets.

@devn
Created July 15, 2014 17:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save devn/8bbca63a1bd6e575c1fd to your computer and use it in GitHub Desktop.
Save devn/8bbca63a1bd6e575c1fd to your computer and use it in GitHub Desktop.
autotune/autocorrect pitch overtone
(defsynth pitch-follow-1 []
(let [in (mix [(sound-in)])
amp (amplitude:kr in 0.05 0.05)
[freq has-freq] (pitch:kr in
:amp-threshold 0.02
:median 7)
out-1 (mix [(var-saw:ar (mul-add:ar 0.5 1 2)
0
(lf-noise1:kr (mul-add:kr 0.3 0.1 0.1)))])
out-2 (loop [n 6
out out-1]
(if (= n 0)
out
(recur (dec n) (allpass-n:ar out 0.040 (rand 0.040) 2))))]
(out:ar 0 out-2)))
(defsynth pitch-follow-2 []
(let [in (mix [(sound-in)])
amp (amplitude:kr in 0.05 0.05)
[freq has-freq] (pitch:kr in :amp-threshold 0.02 :median 7)
out-1 (comb-c:ar (lpf:ar in 1000)
0.1
(mul-add (distort (reciprocal (mul-add freq 2 1))) 0.05 1))
out-2 (loop [n 6
out out-1]
(if (zero? n)
out
(recur (dec n) (allpass-n:ar out 0.040 (rand 0.040) 2))))]
(out:ar 0 out-2)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment