Specifying pitch and duration in Pbind

What are the options to specify both \dur and pitch, say via \degree?
By default one has to specify those params “in parallel”. While of course this can produce nice and interesting patterns, if I want to make more carefully tuned pattern it feels quite challenging to mentally sync pitch and note duration.

There are many options for builing dependencies in Pattern, see James’ Pattern Guide.

Just a few mentions: You can establish dependencies from other keys via Pkey and Pif, similarily also with Pfunc, her you can define any functional relation with

\dur, Pfunc { |e| ... e[\degree] ... }

You can also link with array keys:

Pbind([\dur, \degree], Prand([[0.1, 5], [0.2, 4], [0.5, 2]], inf)).trace.play

You can also define a master pattern and control both params with data sharing.

2 Likes

Thanks will read through it again (for the 20th time probably ;))

As far as I know this only works for single notes, if you change degree to a chord, like [[1/2, [0, 3, 5]] it doesn’t work.

Well, try it out, it works

Pbind([\dur, \degree], Prand([[0.1, 5], [0.2, 4], [0.5, [0, -2, -5]]], inf)).trace.play

I’m getting warning and silence:

WARNING: the pattern is not providing enough values to assign to the key set: [ dur, degree ]

Oh, what system and SC version are you running ?

Version : 3.11.0-4
Arch Linux

This is strange, it works here on OSX 10.13.6 / SC 3.11.0

Do you have quarks installed ?
If yes, try to uninstall all and check again. If it works then you can reinstall incrementally. I’d be very surprised if it’s an system specific issue.

1 Like

Thanks it helped! The issue was caused by MusicalNotation

Filed as a bug. It’s an unfortunate typo.

hjh

2 Likes

Fixed. Thank you both.
You can find the new release (v0.2.4) below:

2 Likes

Here’s example where nested pattern is being ignored (?).

(
Ndef(\q, Pbind(
    \mtranspose, -1,
    \octave, 5,
    [\dur, \degree], Pseq([
        Pn(Pseq([
            [1/5, 1],
            [1/5, Prand([2, 5])],
            [1/5, 7],
            [1/5, \r],
            [1/5, 5],
        ]), 1),
    ], inf),
)).quant_(1).play(fadeTime: 1);
);

Regular version works just fine:

(
Ndef(\q, Pbind(
    \mtranspose, -1,
    \octave, 5,
    \dur, 1/5,
    \degree, Pseq([
        Pn(Pseq([
            1,
            Prand([2, 5]),
            7,
            \r,
            5,
        ]), 2),
    ], inf),
)).quant_(1).play(fadeTime: 1);
);

I think this is not expected to work, the value pattern should return pairs of values. So you get what you want by

(
Pbind(
    \mtranspose, -1,
    \octave, 5,
    [\dur, \degree], Ptuple([
		Pseq(1/5!5, inf),
		Pseq([1, Prand([2, 5]), 7, \r, 5], inf)
	])
).play
)

Though I see that you probably want to define couples with Patterns, this can be done by feeding the flopped couples into a Ptuple:

x = [
	[1/5, 1],
	[1/5, Prand([2, 5])],
	[1/5, 7],
	[1/5, \r],
	[1/5, 5]
];

y = x.flop;

(
Pbind(
    \mtranspose, -1,
    \octave, 5,
    [\dur, \degree], Ptuple([
		Pseq(y[0], inf),
		Pseq(y[1], inf)
	])
).play
)

Or shorter:

(
Pbind(
    \mtranspose, -1,
    \octave, 5,
    [\dur, \degree], Ptuple(y.collect(Pseq(_, inf)))
).play
)
2 Likes

I’m relative new to supercollider, but I tend to agree that specifying freq and dur separated from each other, seems to make composing more difficult.

In TidalCycles this seems to be much easier and intuitive.

It might be worth to check out Panola

http://sccode.org/1-5aq

Hi and welcome

IMO it depends on the viewpoint and what you understand as composing (which, of course, is not a unique definition). Regarding the programming language logic, the separation makes perfect sense: you can define in the most general way, coupling is a special case. I think that this is also an advantage from the compositional point of view, it favors the full width of possibilities.
But indeed, as coupling is something that is often wanted, it also makes sense to think about ways of its easy definition in addition (the suggestion of my patch could certainly be translated into a Function, a Method or a Pattern for more comfortable usage, though I haven’t thought about it in detail yet).

Thanks.
Sure, my perspective is kind of narrow of course as a relative new user. But Tidal is really a relief now for me, it takes less effort in coding to get some tune that sounds well.

The good thing about SuperCollider is that you can do very advanced things, but a way to do this more easily as you more or less suggest would be a really nice addition to Supercollider I think.

I was fiddling with Panola, but I didn’t found out how to sync the tempo properly with Ableton Link feature in SuperCollider, so I gave up for now.

TempoClock.default = LinkClock.new.latency_(s.latency);

That should get you most of the way there.

Having invested 6 years in my own live coding system, I can say that coupling data with rhythm gains some things and loses some things. If the things you gain match up to what you want to do, then it will be “obvious” that concise live coding dialects are “better” – but that doesn’t make it true for all purposes. (Also, live coding dialects are not one size fits all – I’m not sure it’s a good idea to privilege one of them by promoting it into the main distribution.)

hjh

Thanks. Got Link working now with Panola, with the way you suggested.

Actually I did saw your live coding system in a video you posted. I was looking to do something with samples and rhythm, so TidalCycles seemed to me the easiest way to get things running. Might spend more time on yours later, but for now I’m okay.