[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sc-devel] Amplitude.kr problem

Hi all,

Applying Amplitude.kr to an audio-rate signal is allowed, in fact all
the examples in the helpfile do this. However, I noticed that the UGen
doesn't really handle this case "correctly" - if run at control-rate
it simply expects its input to be control rate; the end result on
audio-rate input is a dodgy downsampling which can lead to incorrect

For example, these two should really give similar results but they
don't (give them a few seconds to converge):

x = {(Amplitude.kr(Impulse.ar(44100/64, 0.0),1,1)).poll}.play // 1
x = {(Amplitude.kr(Impulse.ar(44100/64, 0.02),1,1)).poll}.play // 0

Same goes for these:

x = {(Amplitude.kr(SinOsc.ar(44100/64, 0.0),1,1)).poll}.play // 0.098
x = {(Amplitude.kr(SinOsc.ar(44100/64, pi/4),1,1)).poll}.play // 0.77

Options for fixing this:

(1) Alter the UGen source, add a new calc func to deal with the a-to-k
(2) Make Amplitude a subclass of Filter, so it refuses to run k-rate
on an a-rate input (unhelpful!)
(3) Alter the Amplitude class so it automatically replaces
Amplitude.kr(x.ar) with A2K.kr(Amplitude.ar(x.ar))

Any particular thoughts?