# Resetting a Pseg

Probably some stupidity involved here, but I’m trying to figure out how to apply the values of a Pseg to another key in the pattern, adapting the duration of the Pseg to the original \dur before PdurStuttering. I.e in this example i would like the “glissandi” to be downwards only and fill the full period of the \dur before subdividing it. I guess this means that the Pseg needs to be reset after n % ev[\d] because now it just continues where it left of. Is this possible? Or maybe there are better ways to do this? I’ve tried different approaches e.g. doing everything inside a Pfunc or Prout instead of Pseg but i’m stuck and would appreciate any help.

``````(
~d = 8;
p = Pbind(
\d, Pfunc{~d},
\dur, PdurStutter(Pkey(\d), Pseq([0.5, 1], inf)),
\n, Pstutter(Pkey(\d), Pseq([7, 3], inf)),
\env, Pseg(
Pseq([1, 0], inf),
Pfunc{|ev| ev[\d] * ev[\dur]},
\lin
),
\note, Pkey(\n) * Pkey(\env)
).play;
)
p.stop;
``````

You can use zero times

``````(
~d = 8;
p = Pbind(
\d, Pfunc{~d},
\dur, PdurStutter(Pkey(\d), Pseq([0.5, 1], inf)),
\n, Pstutter(Pkey(\d), Pseq([7, 3], inf)),
\env, Pseg(
Pseq([1, 0], inf),
Pseq([Pfuncn { |ev| ev[\d] * ev[\dur] }, 0], inf),
\lin
),
\note, Pkey(\n) * Pkey(\env)
).play;
)

p.stop;``````
1 Like

Awesome! Thanks. I knew it was easy.