How to port code from python / midiutils to (/implement an idea in) supercollider?

Hello everyone,

I was experimenting a little bit with music generation in python with midiutils and someone on reddit mentioned supercollider:

The code I am trying to port is a similar to this:

The main idea is described in the reddit post. If it is possible to implement this idea in sc, how to start?

Sorry for my naive question. I have listened to youtube videos for sc and am very fascinated about it.

Thanks for your help!

Hi and welcome,

here’s a quick test.

// define your Function
// LR operator precedence
f = { |a, b| a + b * a * b % 8 };

// List Comprehension for getting pairs
x = all {:[a, b], a <- (1..8), b <- (1..8) }.collect(f);

// use Patterns with default instrument for quick test
(
Pbind(
	\dur, Pseq(x).collect(_[0]) / 16, // partial application syntax, getting numbers from pairs
	\note, Pseq(x).collect(_[1])
).play
)

Thanks for your answer. That is very helpful!

Hello, you may enjoy FoxDot!

Thanks, it looks interesting

Rethinking this, it’s probably not quite what you have done, as I get it now, you took the tuples to generate a sequence of numbers. Of course the mapping is still open here.

// define your Function
// LR operator precedence
f = { |a, b| a + b * a * b % 8 };

// List Comprehension for getting pairs
x = all {:[a, b], a <- (1..8), b <- (1..8) }.collect(f.(*_));

x.plot

// use Patterns with default instrument for quick test
(
Pbind(
	\dur, 0.2,
	\note, Pseq(x)
).play
)