   process: (child) ->
     unless Function.isFunction(child)
       throw new Error "#{@constructor.name}.process() requires a sound generator but did not receive any."
-    (time) => @realProcess(time, child(time))
+    f = (time) => @realProcess(time, child(time))
+    f.duration = child.duration if child.duration
+    f
 
   realProcess: (time, inputSample) ->
     #y[n] = (b0/a0)*x[n] + (b1/a0)*x[n-1] + (b2/a0)*x[n-2]

    @multiplier = Math.pow(10, @gain / 20)

  process: (nestedProcessors...) ->
    (time) =>
      sample = 0
      for processor in nestedProcessors
        sample += @multiplier * processor(time)
      sample


#

      throw new Error "#{@constructor.name}.process() only accepts a single argument."
    unless Function.isFunction(child)
      throw new Error "#{@constructor.name}.process() requires a sound generator but did not receive any."
    f = (time) => @realProcess(time, child(time))
    f.duration = @attackTime + @decayTime + @sustainTime + @releaseTime
    f


class Mixer
