[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] Immediate Pattern Update via Environment
- To: sc-users@xxxxxxxxxxxxxxxx
- Subject: Re: [sc-users] Immediate Pattern Update via Environment
- From: Dan Stowell <danstowell@xxxxxxxxx>
- Date: Wed, 11 Mar 2009 14:55:02 +0000
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=dD7D9WlNIhbc7nR2vIuXu9tYjZiTVnNxjrC3/K8dvOs=; b=Tcsnr8jNJk0Hsna61p1TV8IEA1uDRbs8rvlAe1160xjjnDrzmMqnXzOifmRFvW6CW+ g0IJA3btz3a8cIBl9BRtpoJYejb+CvEvNeYAeWgxgLCApw/nlrK+zQlC1aAenmjEkTHj firApMX4N76pHn3eQY7WwWXElwjTd+XXJQ0hw=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=LJ979qN+H1609ujyYkzF95+pvQ3VVsIb97U4kQCsF7zNlCtvKE42X7d9Zzz/v28zAs UKk2WXmr6sVqN/8oJivOjCVyH1KncxUEEaEeB1PTjIE+GymEhkPW3+zdIVT99lBvGe65 iF8NV4CL8S9XgAFqkonil/d/8kCqNil8GXEDo=
- In-reply-to: <22427171.post@xxxxxxxxxxxxxxx>
- List-id: SuperCollider users mailing list <sc-users.create.ucsb.edu>
- References: <22427171.post@xxxxxxxxxxxxxxx>
- Reply-to: sc-users@xxxxxxxxxxxxxxxx
- Sender: owner-sc-users@xxxxxxxxxxxxxxxx
Hi -
Here's a different approach... maybe it does what you want:
s.boot
SynthDef("bass",
{
arg freq = 440, gate = 1, amp = 0.5, slideTime = 0.17, ffreq = 1100,
width = 0.15, detune = 1.005, preamp = 4;
var sig,
// --------------------------------------------------
env = Env.adsr(0.01, 0.3, 0.4, 0.1);
freq = Lag.kr(freq, slideTime);
sig = Mix(VarSaw.ar([freq, freq * detune], 0, width,
preamp)).distort * amp
* EnvGen.kr(env, gate, doneAction: 2);
sig = LPF.ar(sig, ffreq);
// --------------------------------------------------
Out.ar(0, sig ! 2)
}).memStore;
~mynotes = { 40 };
~pattern1 = Pbind(
\instrument, "bass",
/* Pfunc dynamically evaluates things; Pflatten unpacks arrays if
we supply them */
\midinote, Pflatten(1, Pfunc({~mynotes.value})),
\dur, Pseq([1.0,1.0,1.0,1.0], inf),
\legato, Pseq([0.9, 0.3, 0.3, 0.3, 0.3], inf),
\amp, 0.5,
\detune, 0.005
);
~pattern1.play;
// Now because of the Pfunc (which will dynamically
// query the ~mynotes variable), you can update on-the-fly:
~mynotes = { [40, 50] }
~mynotes = { (41..69) }
HTH
Dan
2009/3/10 Ataxian <rhysperkins@xxxxxxxxxxxxxxx>:
>
> If I have the following PDefn:
>
> // Set Pattern1 environment first with initial values
> Pdefn(\Pattern1).set
> (
> \instrument, "bass",
> \midinote, 40,
> \dur, Pseq([1.0,1.0,1.0,1.0], inf),
> \legato, Pseq([0.9, 0.3, 0.3, 0.3, 0.3], 1),
> \amp, 0.5,
> \detune, 0.005
> );
> // Need to refer to Pattern1 environment in some way so create a variable =
> envir
> e = Pdefn(\Pattern1).envir;
> // Define Pattern1
> Pdefn //(key,Pattern)
> (
> \Pattern1,
> {
> arg e;
> Pbind
> (
> \instrument, e.instrument,
> \midinote, e.midinote,
> \dur, e.dur,
> \legato, e.legato, // /legato is a common synth parameter (find out
> others)
> \amp, e.amp,
> \detune, e.detune
> )
> }
> );
>
> Which is played via instrument:
>
> SynthDef("bass",
> {
> arg freq = 440, gate = 1, amp = 0.5, slideTime = 0.17, ffreq = 1100,
> width = 0.15,
> detune = 1.005, preamp = 4;
> var sig,
> // --------------------------------------------------
> env = Env.adsr(0.01, 0.3, 0.4, 0.1);
> freq = Lag.kr(freq, slideTime);
> sig = Mix(VarSaw.ar([freq, freq * detune], 0, width, preamp)).distort *
> amp
> * EnvGen.kr(env, gate, doneAction: 2);
> sig = LPF.ar(sig, ffreq);
> // --------------------------------------------------
> Out.ar(0, sig ! 2)
> }).load(s);
>
> Using the command:
>
> Pseq([Pdefn(\Pattern1)], inf).play;
>
> How do I change the environment for the next note in the sequence rather
> than when the pattern is repeated?
>
> For example setting a new \midinote:
>
> Pdefn(\Pattern1).set(\midinote, 70);
>
> Will only update once the pattern has come to the end of a repetition. How
> can I update it immediately, or when it is next safe to do so?
>
> Thanks
>
>
>
> --
> View this message in context: http://www.nabble.com/Immediate-Pattern-Update-via-Environment-tp22427171p22427171.html
> Sent from the Supercollider - User mailing list archive at Nabble.com.
>
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
> archive: https://listarc.bham.ac.uk/marchives/sc-users/
> search: https://listarc.bham.ac.uk/lists/sc-users/search/
>
--
http://www.mcld.co.uk
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/