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

Re: [sc-users] ping-pong line



hi Ricardo,
not quite sure i follow you. values should be reflected back (folded) within bounds 0-100? if so, here's an example demonstrating that.

s.boot;
(
SynthDef(\pptest, {|out= 0, freq, lagTime, i_lo, i_hi|
	var pingpong;
	pingpong= Fold.kr(Ramp.kr(freq, lagTime), i_lo, i_hi);//linear
	//pingpong= Fold.kr(Lag.kr(freq, lagTime), i_lo, i_hi);//exp
	Out.ar(out, SinOsc.ar(pingpong*#[1, 1.01], 0, 0.1));
}).send(s);
)

a= Synth(\pptest, [\freq, 400, \lagTime, 2, \i_lo, 400, \i_hi, 600]);
a.set(\freq, 900); //go from 400 to 900 but bounce back. fold range 400-600
a.set(\freq, 400, \lagTime, 5);	//go back slower

a.free;

(
a= Synth(\pptest, [\freq, 0, \i_lo, 100, \i_hi, 233.333]);	//new bounds
fork{
	300.do{|i|
		0.1.wait;
		a.set(\freq, i*100, \lagTime, #[0.1, 0.01].wrapAt(i));
	};
	a.free;
})


On 16.05.2006, at 00:40, Ricardo Guerreiro wrote:

Hello,

I'm trying to do in SC something I've been already using in Max/Msp. That is a kind of ping-pong line wich has an infinite behaviour because it constantly redefines its starting value from its ending value; I mean, it starts again from the value where it ended before (always within predefined limits).

Ex. moving  from 0 tp 100:
 36 --»  85 --»  53 --» 21 --» 11 --» 79 (...)

I hope I wasn't too much confusing.

Any helps?


  #|
     fredrikolofsson.com     klippav.org     musicalfieldsforever.com
  |#