Are there any good tutorials, guides or examples that shows how to create a melody based on the current chord playing, with consideration to stuff like pauses and harmony, so that the melody doesn’t sound completely random? I know I sound pretty shallow in my request, but I am very new to programming and only have a simple knowledge of basic music theory.
Hi,
this comes up quite often in variants, so I’m repeating my answer from here:
https://www.listarc.bham.ac.uk/lists/sc-users-2019/msg66280.html
see the data sharing chapter of the Practical Guide
http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_06g_Data_Sharing.html
here a more recent example from the list
https://www.listarc.bham.ac.uk/lists/sc-users-2019/msg65459.html
and three threads on the forum with related examples
ad 1) It’s not possible to ‘multi-node-expand’ the Pattern with an array value for ‘dur’. For good reason, because it would lead to ambiguities. The syntax [\midinote, \dur] is useful for something else: if you want to couple certain midinotes with certain durations, e.g. with Ptuple.
ad 2) As the answer to (1) is no, a different strategy has to be taken: data sharing http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_06g_Data_Sharing.html
(
x = Pbind(
\dur, Pseq([2, 1, 1, Prand([1/2, 1/3, …
The standard way to do this is data sharing with parallel Patterns / EventStreamPlayers
http://doc.sccode.org/Tutorials/A-Practical-Guide/PG_06g_Data_Sharing.html
(
x = Pbind(
\instrument, Pseq([\a, \b], inf).collect(~i=_),
\dur, 1,
\type, \rest
);
y = Pbind(
\instrument, Pfunc { ~i },
\degree, Pseq([1, 2, 3, 4], 1),
\dur, 0.5
);
)
u = Ptpar([0, x, 0.0001, y]).asStream.nextN(6, ());
u.select { |e| e.type.isNil }
Time-shifting is necessary and can be compensated if wanted. See the…
Hi,
not on the wrong path, but it’s one of those pattern questions, that sound very easy, but are tricky in detail. But first, there are two problems in the posted code:
If you want to set the latency, you’d have to do it in a different way, otherwise latency isn’t set (check with m.latency after evaluating the above line). Also I wouldn’t set the latency to such a low value, because the server latency is still 0.2 (however you could set both to 0.05 or so). With my setup I need MIDIOut(0), b…
There are countless other examples in the old archive if you search “data sharing”
https://www.listarc.bham.ac.uk/lists/sc-users-old/search/
In any case note the time-shift, which is necessary in most examples for order of execution.