«scritch scratch (tweet)» by snappizz

on 07 Aug'16 17:03 in sctweet

sc3plugins required

1
2
// turn your volume down! this peaks at 0dBFS!
play{Decimator.ar(Select.ar({r=TRand.ar(0,3,b=BlitB3 ar:8)}!2,[Decay.ar(b,0.1**r)*GbmanN.ar/2,Ringz.ar(b,3**r*9)]),5**r*1e3).sin}
raw 177 chars (focus & ctrl+a+c to copy)
reception
comments
p.dupuis user 09 Aug'16 02:25

Nice! I tried removing the "!2" and it made no sound. Why is that?

snappizz user 09 Aug'16 13:52

{...}!2 is a shorthand for 2.collect{...}. {...} is a function. so you also need to remove the braces around "r=Trand.ar(...)".

p.dupuis user 09 Aug'16 16:17

Normally, a UGen can take a function as an argument no problem. Try replacing "!2" with ".value". It plays on the left channel, which is what you would expect. Why doesn't it work the same without it?

p.dupuis user 09 Aug'16 16:38

It has something to do with the assignments of r and b inside the function.

snappizz user 09 Aug'16 23:21

oh yeah you're right. Didn't realize you could do stuff like SinOsc.ar({440}). the assignments are probably involved but I'm having trouble figuring out how...

kisielk user 10 Aug'16 02:33

How does this syntax work? TRand.ar(0,3, b=BlitB3 ar:8)

snappizz user 10 Aug'16 14:30

it's two character-saving tricks. first, you have an assignment doubling as an expression. you can save two chars by merging b=440;SinOsc.ar(b) into SinOsc.ar(b=440). don't ever do this in real code!

the second is the so-called key binary operator. a b: c is equivalent to a.b(c). take out the second space and you save a char. you can use it if you're passing exactly 1 argument to the message.