Combine Pattern and bus.asMap?

Hello all,

I’m looking for a way to combine a Pattern of value and a bus.asMap with priority to Pattern inside a Pbind.
To benefit from both continous and discrete world.
Something like this:

(
~bus = Bus.control(s, 1).set(0);

Pdef(\merge,
	Pchain(
		Pbind(
			\degree, Pkey(\degree) <> ~bus.asMap // this doesn't work
		),
		Pbind(
			\degree, Pseq([20, 30, 40].midiratio, inf)
		)
	).trace;
);
)

Pdef(\merge).play;

Pdef(\merge).stop;

~bus.set(rrand(200, 1000).postln);
// ~bus.get;

Is this possible to achieve something like this ?
Combining value from a Pattern with value from a bus with priority to the Pattern (and value from the bus inbetween) ? Some kind of Pchain for value pattern ? Maybe a Quark ?

Thank you

Have a look at the excellent AlgaLib https://github.com/vitreo12/AlgaLib

2 Likes

Thank you for your answer,
yes AlgaLib looks interesting.
I don’t know it very well.
For the moment, I can’t see how is it related to my problem but I will take a closer look.
Maybe you can point me to something in particular in AlgaLib which can help me to achieve the desired behavior ?

Bus mapping is valid only when you want a synth control to read directly from a control bus.

Bus mapping does not provide any way to do additional math on the values from the bus. (You can write any kind of math on the control arg in the SynthDef, but this is true of any control, whether it will be mapped or not. The question sometimes comes up, though, of whether you can insert some math in between the bus and the control input, so that it doesn’t have to be written in the SynthDef. The answer is no, not in the server. If you wanted to do additional modulation, it can be done, but it would have to be written within either that synth or a different synth.)

For the pattern case – if the server is on the same machine, then you could use Pfunc { ~bus.getSynchronous }. (One point to clarify with this method, though, is that it will fetch the value at the last hardware buffer boundary. “Synchronous” means only that it returns immediately with a value, in contrast to ~bus.get whose result is asynchronous. It isn’t a sample-accurate get, and it works only for control buses. But for typical LFOs, it’s good enough.)

hjh

1 Like

Thank you and some more characters