Skip to content

Instantly share code, notes, and snippets.

@ctford
Created July 8, 2012 16:40
Show Gist options
  • Select an option

  • Save ctford/3071723 to your computer and use it in GitHub Desktop.

Select an option

Save ctford/3071723 to your computer and use it in GitHub Desktop.
Bell
(definst bell# [frequency 440 duration 4.0]
(let [harmonic-decay [1.0 0.5 0.25 0.125]
partials (map-indexed
(fn [harmonic proportion]
(let [envelope (env-gen (perc 0.01 (* duration proportion)))
overtone (* (inc harmonic) frequency)]
(* envelope proportion (sin-osc overtone))))
harmonic-decay)]
(detect-silence (first partials) :action FREE)
partials))
@neatonk

neatonk commented Jul 8, 2012

Copy link
Copy Markdown

As a regular synth, this example would have an array of 5 output channels... one for each item in harmonic decay. However, In Overtone 0.7, insts support mono/stereo output only, so the rest of the channels are simply discarded. You can use (mix partials) to mix all 5 channels down to a single output.

@ctford

ctford commented Jul 15, 2012

Copy link
Copy Markdown
Author

Gotcha. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment