Skip to content

Commit

Permalink
Separate out the volume and decay of the partials so that it's easier…
Browse files Browse the repository at this point in the history
… to slip in the sub-harmonic.
  • Loading branch information
ctford committed Aug 4, 2012
1 parent a331120 commit d7b2955
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/goldberg/variations/canone_alla_quarta.clj
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@
;(stop)

; harmonics
(definst bell [frequency 300 duration 10.0 h0 1.0 h1 0.5 h2 0.4 h3 0.25 h4 0.20 h5 0.125]
(let [harmonic-progression [1 2 3 4 5 6]
harmonic-decay [h0 h1 h2 h3 h4 h5]
(definst bell [frequency 300 duration 10.0 h0 1.0 h1 0.6 h2 0.4 h3 0.25 h4 0.20 h5 0.125]
(let [harmonics [ 1 2 3 4 5 6]
decays [h0 h1 h2 h3 h4 h5]
volumes [h0 h1 h2 h3 h4 h5]
proportional-partial
(fn [harmonic proportion]
(let [envelope (env-gen (perc 0.01 (* duration proportion)))
(fn [harmonic volume decay]
(let [envelope (env-gen (perc 0.01 (* duration decay)))
overtone (* harmonic frequency)]
(* envelope proportion (sin-osc overtone))))
partials (map proportional-partial harmonic-progression harmonic-decay)
(* decay envelope (sin-osc overtone))))
partials (map proportional-partial harmonics volumes decays)
whole (mix partials)]
(detect-silence whole :action FREE)
whole))
Expand All @@ -63,9 +64,9 @@
;; Psycho-acoustics ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;(bell 600 20.0)
;(bell 500 20.0 0.0)
;(bell 400 20.0 0.0 0.0)
;(bell 600 10.0)
;(bell 500 10.0 0.0)
;(bell 400 10.0 0.0 0.0)
;(stop)


Expand Down Expand Up @@ -95,7 +96,7 @@

;(midi->hz 69)

(defn ding! [midi] (bell (midi->hz midi) 2.5 0.8 0.3 0.1 0.2 0.05 0.05))
(defn ding! [midi] (bell (midi->hz midi) 3.0))

(defn play [notes]
(let [start (now)
Expand Down

0 comments on commit d7b2955

Please sign in to comment.