57 lines
2.4 KiB
Common Lisp
57 lines
2.4 KiB
Common Lisp
(in-package #:cl-collider)
|
|
;; https://github.com/SCLOrkHub/SCLOrkSynths
|
|
;; https://github.com/SCLOrkHub/SCLOrkSynths/blob/master/SynthDefs/strings/violin.scd
|
|
|
|
(defsynth violin ((freq 440) (gate 1) (amp 1) (pan 0) (out 0) (att 0.1) (dec 0.1) (sus 0.5) (rel 0.1)
|
|
(vRate 4.6) (vDepth 0.02) (vAtt 0.15) (vRateVar 0.25) (vDepthVar 0.05)
|
|
(pwmVarRate 2) (pwmMin 0.7) (pwmMax 0.8) (pwmRate 5)
|
|
(bridgeFreq 2500) (scratchDepth 0.15))
|
|
(let* ((scratch (+ 1.025 (env-gen.kr (perc att (* 1.25 dec) scratchDepth))))
|
|
(envelope (env-gen.kr (adsr att dec sus rel) :gate gate :act :free))
|
|
(freq (vibrato.kr freq vRate vDepth (+ att dec) vAtt vRateVar vDepthVar))
|
|
(pwm-step-1 (range (sin-osc.kr pwmRate (rand.ir 0.0 1.0)) pwmMin pwmMax))
|
|
(pwm-step-2 (* pwm-step-1 (range (lf-noise2.kr pwmVarRate) 0.2 0.8)))
|
|
(snd-step-1 (var-saw.ar (*
|
|
(lag.kr freq)
|
|
(range (lf-pulse.ar (* freq 1.5)) (/ 1 scratch) scratch))))
|
|
(snd-step-2 (+ (* snd-step-1 0.7)
|
|
(bpf.ar snd-step-1 bridgeFreq 2 2)))
|
|
(snd-step-3 (* snd-step-2 amp envelope)))
|
|
(out.ar out (pan2.ar snd-step-3 pan))))
|
|
;; (synth :violin :freq 400)
|
|
;; (stop)
|
|
(in-package #:cl-patterns)
|
|
(pb :foo-with-pluck-synth
|
|
:instrument :violin
|
|
:play-quant 4
|
|
:decay 2
|
|
:att 0.07
|
|
:sus 0.8
|
|
:amp 0.1
|
|
:legato 1
|
|
:degree (pseq (list 0 1 2 3 4 5 6 7) 1)
|
|
:dur 1)
|
|
;; (play :foo-with-pluck-synth)
|
|
;; (end :foo-with-pluck-synth)
|
|
;; (stop :foo-with-pluck-synth)
|
|
;;
|
|
;; let's make it a simple gamma?
|
|
;; cool, and easy with the :degree (from pitch model http://doc.sccode.org/Tutorials/Streams-Patterns-Events5.html )
|
|
|
|
(pb :mary-had-a-little-lamb
|
|
:instrument :violin
|
|
:play-quant 16
|
|
:legato 1
|
|
:degree (pseq (list 6 5 4 5 6 6 6 5 5 5 6 6 6 6 5 4 5 6 6 6 6 5 5 6 5 4) 1)
|
|
:dur (pseq (list 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 4))
|
|
:scratchdepth (pseq (list 0.1 0 0 0))
|
|
:vdepth (pseq (list 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.02 0.06))
|
|
)
|
|
|
|
;; (play :mary-had-a-little-lamb)
|
|
;; (end :mary-had-a-little-lamb)
|
|
;; (stop :mary-had-a-little-lamb)
|
|
|
|
;; there has to be a better way to split the tacts
|
|
;; (render (pdef :mary-had-a-little-lamb) "/tmp/mary.wav" :dur 32)
|