musikinformatik / Steno

Concatenative little metalanguage for live coding
GNU General Public License v2.0
65 stars 7 forks source link

Topic/variable diff #26

Closed rkuivila closed 7 years ago

rkuivila commented 7 years ago

Here is an alternative diff written in SuperCollider. This is more tightly integrated into Steno in that the differencing operation modifies the synthList and argList directly. (This simplified the implementation and made it easier to create alternative approaches to the differencing operation.)

rkuivila commented 7 years ago

Here is an example session also in VarDiff.sc:

t = Steno.new;
VarDiff.new.install(t);
t.diff.diff1;
t.quelle(\a, { Blip.ar(Rand(4, 16)) * 0.2 });
t.quelle(\b, { Saw.ar(Rand(400, 700)) * 0.2 });
t.filter(\f, { |input| CombL.ar(input, 0.2, Rand(0.01, 0.02), Rand(0.4, 2) ) });
t.diff.diff0;
t.value("!faa"); ""
t.value("faaf"); ""
t.value("faaf"); ""
t.value("faaf"); ""
t.diff.diff1;
t.value("faa"); ""
t.value("aaf"); ""
t.value("faa"); ""
t.value("aaf"); ""
t.diff.diff2;
t.value("faa"); ""
t.value("aaf"); ""
t.value("faa"); ""
t.value("aaf"); ""
telephon commented 7 years ago

Thank you, this looks like a very good start. As we go, I'd like to integrate this with the branch https://github.com/telephon/Steno/tree/topic-renew-synths, which is essentially just this: https://github.com/telephon/Steno/pull/24

rkuivila commented 7 years ago

Hi Julian, I mentioned to Till the possibility of using an integer to identify different replacement policies available via VarDiff. Right now, it would be something like: 0 - holds towards the end so faa -> aaf would keep aa 1 - holds towards the front so faa-> aaf would keep f 2, 3 - hold onto anything possible, regardless of order so faa-> aaf would just reorder 2 goes in order, 3 goes in reverse order so faa -> aaf would reverse the a's Another might be a random shuffle of all identical synths. Another possibility could be to hold on to the longest unaltered substring.

All that functionality can be kept in VarDiff, leaving Steno unaltered. But it would steal integers from the synth namespace.

RJK

telephon commented 7 years ago

if I have a transition from abc to [(abc)f xyz], will this keep abc untouched?

telephon commented 7 years ago

@rkuivila wrote:

Hi Julian,

yes. At the moment, VarDiff prints out: newstring removed synths (oldstring with underscores as placeholders for synths being reused) newsynthstate (newstring with preexisting synths capitalized)

So the default diff starting at "faa" would look like: "aaf" f__ AAf

"faa" __f fAA

"aaf" f__ AAf

But diff2 holds onto everything it can, so it would look like:

"aaf"


AAF

"faa"


FAA

"afa"


AFA

And the sequence you asked using diff0 for looks like: "abc" [((___)f)(xyz)] ABC

"[((abc)f)(xyz)]"


[((ABC)f)(xyz)]