Skip to content

Instantly share code, notes, and snippets.

@scztt
Created November 15, 2023 22:38
Show Gist options
  • Save scztt/363a8a3354aa52410c6746ded0d4a1b0 to your computer and use it in GitHub Desktop.
Save scztt/363a8a3354aa52410c6746ded0d4a1b0 to your computer and use it in GitHub Desktop.
+Object {
|> {
|other|
^other.value(this)
}
+> {
|other, adverb|
^(this +.(adverb) other.value(this))
}
*> {
|other, adverb|
^(this *.(adverb) other.value(this))
}
++> {
|other, adverb|
^(this.asCollection ++.(adverb) other.value(this).asCollection)
}
||> {
|other|
^this.collect(_ |> other)
}
>|| {
|other|
^other.collect(this |> _)
}
expBlend { arg that, blendFrac = 0.5, min=1;
var offset = max(0, min - this);
^blendFrac.linexp(0, 1, this + offset, that + offset) - offset;
}
}
@LFSaw
Copy link

LFSaw commented Nov 16, 2023

this looks cool! mind to explain a little what each of the operators do?

@LFSaw
Copy link

LFSaw commented Nov 16, 2023

I started:

+Object {
	// fold filter around signal
	|> {
		|other|
		^other.value(this)
	}
	// fold filter around signal but also keep original dry signal
	+> {
		|other, adverb|
		^(this +.(adverb) other.value(this))
	}
	// fold filter around signal and multiply (ringmod) with original signal
	*> {
		|other, adverb|
		^(this *.(adverb) other.value(this))
	}
	// Array:add filtered signal to dry signal 
	++> {
		|other, adverb|
		^(this.asCollection ++.(adverb) other.value(this).asCollection)
	}
	// multichannel version of |> 
	||> {
		|other|
		^this.collect(_ |> other)
	}
	// multichannel version of |> but dry signal is this object
	>|| {
		|other|
		^other.collect(this |> _)
	}
	// exponential blend
	expBlend { arg that, blendFrac = 0.5, min=1;
		var offset = max(0, min - this);
		^blendFrac.linexp(0, 1, this + offset, that + offset) - offset;
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment