[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-dev] Some 'demand' questions
- To: sc-dev <sc-dev@xxxxxxxxxxxxxxxx>
- Subject: [sc-dev] Some 'demand' questions
- From: "James Harkins" <jamshark70@xxxxxxxxx>
- Date: Thu, 11 Dec 2008 13:00:44 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:reply-to :to:subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=8RCwiEEu3mWnVZDBFlO8n5ue8fvjK0Vl7IU5+neuof4=; b=aPJzvre29vJ/CBXhsVHH299gQHPExNmqxnMeL3PQ7B3nMq1mHXHE6ebpVoCSfaGjpM hdQmcEXYegGm2ah8QRBCoV6iAu8EGAbBKdJhiAYkKmz7n4jPVZo9CT8Wl7soodFIz6bK AnCZxxZlAYDnyhqOe81Dybd2dV4+0uD9ot/kA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=Cv4shlF4z7KgWSP83YZWpUrYtxcxbKlD7CJcWYRAPGix/fmYkwnfE8PdiI4T3G81uS gK8BglSiPW2B/7VmmwmK6/LJol6hieIWJ8/n8r99kgrX0zdWPuMjMrdTWpq7lHCGI8cN Sz5Pcuf1igs7v/Yg0Zq+8jYpJkGfWfYxsNaRY=
- List-id: SuperCollider developers mailing list <sc-devel.create.ucsb.edu>
- Reply-to: sc-dev@xxxxxxxxxxxxxxxx
- Sender: owner-sc-dev@xxxxxxxxxxxxxxxx
I often do something like this in my synths:
a = play {
var initPulse = Impulse.kr(0),
time = Select.kr(initPulse, [LocalIn.kr(1), ExpRand(0.1, 0.25)]),
trig = Impulse.kr(time.reciprocal),
newTime = TExpRand.kr(0.1, 0.25, trig),
freqs = TExpRand.kr(200, 900, trig ! 2),
freq = EnvGen.kr(Env.new(freqs[[0, 0, 1]], [0, 1]), trig, timeScale: newTime);
LocalOut.kr(newTime);
(SinOsc.ar(freq, 0, 0.3) * Decay2.kr(trig, 0.01, newTime * 0.7)) ! 2;
};
I need to know the time until the next trigger to get the frequency
and decay envelopes right.
With TDuty, I could get triggers appropriately timed but I don't see a
way to get the duration values outside TDuty. This would not work with
non-determinate demand ugens:
var demands = Dwhite(0.1, 0.5, inf),
trig = TDuty.kr(demands, 0, demands);
... because 'demands' would evaluate differently in the two places.
Have I overlooked a ugen that would do what I want here? Or should I
roll up my sleeves and write a new one? If there were a TDuty variant
that returned the duration value as the trigger's impulse, it would be
easy to latch it and have the time.
var demands = Dwhite(0.1, 0.5, inf),
trig = UnknownUGenHere.kr(demands),
time = Latch.kr(trig, trig);
Also it seems demand ugens don't work with n-ary operators, though
binary ops are ok.
This is OK:
a = SynthDef(\demandMath, {
var trig = Impulse.kr(2);
Demand.kr(trig, 0, Dwhite(0.0, 1.0, inf) + 2).poll(trig, "dwhite");
}).play;
This is not (always posts 200):
a = SynthDef(\demandMath, {
var trig = Impulse.kr(2);
Demand.kr(trig, 0, Dwhite(0.0, 1.0, inf).linexp(0.0, 1.0, 200,
800)).poll(trig, "dwhite");
}).play;
That is a problem for generating exponentially-distributed durations
for TDuty (unless Dexprand has been added - I don't see it in svn).
Thanks.
hjh
--
James Harkins /// dewdrop world
jamshark70@xxxxxxxxxxxxxxxxx
http://www.dewdrop-world.net
"Come said the Muse,
Sing me a song no poet has yet chanted,
Sing me the universal." -- Whitman
_______________________________________________
sc-dev mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/