Discussion:
Pbind structure into a Synthdef
wallace
2014-09-29 20:35:44 UTC
Permalink
Hello,

I am trying to build a Pbind into a Synthdef.
Here is the Pbind:
4.do({ Pbind( \note, Pbrown(0, 20, 0.1, inf) ,\dur, 0.05.rand ).play });

I was thinking to change the freq of the standard synth this way:
freq = Array.fill(4, Demand.kr(Impulse.kr(4), 0, Dbrown(0, 15, 1,
inf)*mul));
in order to achieve the same sound effect.
Unfortunately i don't get the same frequency shifting sound.

Anyone knows how can I do that?

Best,
Marcello


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Daniel Mayer
2014-09-29 21:52:50 UTC
Permalink
Hi,

for triggering you'd need the reciprocal of duration,
BTW 0.05.rand is a bit in danger to cause a hang
as this can be an extremely short duration.

Multiple freq triggers could be built into default synth
but it's just complicating and if you don't
have a special reason for it I'd just define it for a single voice -
no problem to run a number of synths in parallel.


E.g. like this, now expects midi pitches

(
SynthDef(\default_dbrown, { arg out=0, lo=60, hi=80, step=0.1, rate=20, amp=0.1, pan=0, gate=1;
var z, freq;
freq = Demand.kr(Impulse.kr(rate), 0, Dbrown(lo, hi, step)).midicps;
z = LPF.ar(
Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);
OffsetOut.ar(out, Pan2.ar(z, pan, amp));
}, [\ir]).add;
)

x = Synth(\default_dbrown);

x.release;


// 4 in parallel

y = { Synth(\default_dbrown) }!4;

y.do(_.release)


// 4 in parallel with random params

z = { Synth(\default_dbrown, [\rate, rrand(20, 50), \lo, rrand(40, 60)]) }!4;

z.do(_.release)


Greetings

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------



_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
wallace
2014-09-30 08:19:11 UTC
Permalink
Hi Daniel,

thanks for your answer: this is exactly what i was trying to do!
Post by Daniel Mayer
Hi,
for triggering you'd need the reciprocal of duration,
BTW 0.05.rand is a bit in danger to cause a hang
as this can be an extremely short duration.
Multiple freq triggers could be built into default synth
but it's just complicating and if you don't
have a special reason for it I'd just define it for a single voice -
no problem to run a number of synths in parallel.
the reason is, I would like to control the sound with osc messages but
you cannot change a Pbind value while running, that's why I was thinking
to build in the multiple triggers into the synthdef.
Are there any other possibilities?

Best,
M
Post by Daniel Mayer
E.g. like this, now expects midi pitches
(
SynthDef(\default_dbrown, { arg out=0, lo=60, hi=80, step=0.1, rate=20, amp=0.1, pan=0, gate=1;
var z, freq;
freq = Demand.kr(Impulse.kr(rate), 0, Dbrown(lo, hi, step)).midicps;
z = LPF.ar(
Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);
OffsetOut.ar(out, Pan2.ar(z, pan, amp));
}, [\ir]).add;
)
x = Synth(\default_dbrown);
x.release;
// 4 in parallel
y = { Synth(\default_dbrown) }!4;
y.do(_.release)
// 4 in parallel with random params
z = { Synth(\default_dbrown, [\rate, rrand(20, 50), \lo, rrand(40, 60)]) }!4;
z.do(_.release)
Greetings
Daniel
-----------------------------
www.daniel-mayer.at
-----------------------------
_______________________________________________
sc-users mailing list
info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Daniel Mayer
2014-09-30 09:44:24 UTC
Permalink
Post by wallace
the reason is, I would like to control the sound with osc messages but
you cannot change a Pbind value while running,
In fact while running you can control the EventStreamPlayer got
from the Pbind, not the Pbind itself, which is always only a template -
but there numerous ways to do the first.

But what are you wanting to change while running ?
Are you going to control from outside SC ?

Greetings

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------



_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
wallace
2014-09-30 09:58:15 UTC
Permalink
Post by Daniel Mayer
Post by wallace
the reason is, I would like to control the sound with osc messages but
you cannot change a Pbind value while running,
In fact while running you can control the EventStreamPlayer got
from the Pbind, not the Pbind itself, which is always only a template -
but there numerous ways to do the first.
ok, that's good to know!
I was having a look at the help file but there are no examples: can you
maybe point to some tutorials?
Post by Daniel Mayer
But what are you wanting to change while running ?
Are you going to control from outside SC ?
I would like to change parameters like rate, lo, hi and everything
possible :)
I wanna to control from TouchOsc and with some interactive dance: both
systems use OSC.

Best,
Marcello


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Daniel Mayer
2014-09-30 10:51:55 UTC
Permalink
Post by wallace
ok, that's good to know!
I was having a look at the help file but there are no examples: can you
maybe point to some tutorials?
Post by Daniel Mayer
But what are you wanting to change while running ?
Are you going to control from outside SC ?
I would like to change parameters like rate, lo, hi and everything
possible :)
Ok, here a control example for your patterns without OSC first


// one possible way: envir vars

~rate = 30;

// assign to var, so you can stop single ones also

x = 4.collect { Pbind(\note, Pbrown(0, 20, 0.1, inf),\dur, Pfunc { 1/~rate } ).play }

// change on the fly

~rate = 5;

x.do(_.stop)


You can also use Pdefn, Pdef and Pbindef from JITlib.
PLx patterns from miSCellaneous lib do basically the same as above, for a number of special
patterns like Pbrown the PLx variants are quite practical

(
~lo = 0;
~hi = 20;
~rate = 30;
~step = 0.1;

x = 4.collect { Pbind(\note, PLbrown(\lo, \hi, \step), \dur, 1/PL(\rate) ).play }
)


// shrink range

~hi = 10;

// change step width

~step = 1

x.do(_.stop)


// first example with OSC control
// if you have short durations, a change of pattern params will have nearly
// immediate effect


// spoof OSC from SC

(
n = NetAddr("127.0.0.1", NetAddr.langPort);
m = NetAddr("127.0.0.1", NetAddr.langPort); // loopback
OSCFunc({|msg| ~rate = msg[1] }, '/rate', n);
)

(
~rate = 30;
x = 4.collect { Pbind(\note, Pbrown(0, 20, 0.1, inf),\dur, Pfunc { 1/~rate } ).play }
)

m.sendMsg(\rate, 3);

x.do(_.stop);



There is a variety of control possibilities for playing event patterns.
miSCellaneous lib contains two tutorials related:
"Event patterns and LFOs" and "Event patterns and Functions"

This can all be combined with OSC control of language and server,
so a huge number of control strategies possible.


Greetings

Daniel

----------------------------------------------------
http://daniel-mayer.at/software_en.htm
----------------------------------------------------








_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/

Loading...