Created
July 4, 2011 19:48
-
-
Save pepijndevos/1063841 to your computer and use it in GitHub Desktop.
Overtone Vocoder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns test | |
(:use overtone.live | |
;overtone.inst.synth | |
overtone.inst.io)) | |
(def a (buffer 2048)) | |
(def b (buffer 2048)) | |
(definst vocoder [freq 432] | |
(let [input (in 8) | |
src (mix [(saw (* 1.01 freq)) (saw (* 0.99 freq))]); synth | |
formed (pv-mul (fft a input) (fft b src)) | |
audio (ifft formed)] | |
(normalizer audio))) | |
(def kb (midi-in)) | |
(def mem (atom {})) | |
(def logg (atom ())) | |
(defn assoc-once [m k v] | |
(if-not (get m k) | |
(assoc m k (v)) | |
m)) | |
(defn midi-responder [event timestamp] | |
; my synth has no :note-off, ajust accordingly | |
(when (= (:cmd event) :note-on) | |
(swap! logg conj event) | |
(if (> (:vel event) 0) | |
(swap! mem assoc-once | |
(:note event) | |
#(vocoder (midi->hz (:note event)))) | |
(do | |
(kill (get @mem (:note event))) | |
(swap! mem dissoc (:note event)))))) | |
(midi-handle-events kb midi-responder) |
Two buffers. I'll add them.
What fun! Sounds nice with pink noise and a bit of reverb too:
(demo 60
(let [input (in 8) ; mic
src (pink-noise) ; synth
formed (pv-mul (fft a input) (fft b src))
audio (ifft formed)
reverbed (g-verb audio 9 0.7 0.7)]
(pan2 (* 0.1 reverbed))))
What I want to try is to find/make a synth with a 'full' sound, and hook it up to my keyboard. Only my keyboard doesn't send :note-off signals :(
You could make a monophonic keyboard :-) Have you had a look in overtone.inst.synth for something 'full'?
I figured mine sends {:note-on :vel 0} on release. pad is fine, although I'd like it more pinchy.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What are
a
andb
in this code?