Skip to content

Instantly share code, notes, and snippets.

@LFSaw
LFSaw / OpenSynthDefs-demands.md
Created July 27, 2011 15:00
Demands for a web-based platform for SynthDefs
  • A SynthDef entry should include
    • the SynthDef
    • a description
    • the user / uploader
    • tags
    • attribution
    • a fixed and permanent ID
    • a voting system
  • User authentication
  • Browsing based on tags
@LFSaw
LFSaw / OpenSynthDefs-demands.md
Created July 27, 2011 15:00
Demands for a web-based platform for SynthDefs
  • A SynthDef entry should include
    • the SynthDef
    • a description
    • the user / uploader
    • tags
    • attribution
    • a fixed and permanent ID
    • a voting system, maybe implemented as a second tagging system where visitors can characterize sounds by adjectives
  • User authentication
  • Random Synthdef button
@LFSaw
LFSaw / SynthDef.sc
Created July 27, 2011 17:29
haha edited
a fifth update
@LFSaw
LFSaw / Gist.sc
Created July 27, 2011 18:06
accessing the Gist API from within SuperCollider
Gist {
*allGistsFor {|user, username, password|
var options;
options = password.notNil.if({
"-u %:%".format(username, password)
}, {
""
});
@LFSaw
LFSaw / SynthDef.sc
Created July 29, 2011 11:03
My first GIst gist
SynthDef("out", {Out.ar(0, FSinOsc.ar(247))})
@LFSaw
LFSaw / SynthDef.sc
Created July 29, 2011 11:03
My second GIst gist
SynthDef("out", {Out.ar(0, FSinOsc.ar(247); \haha)})
@LFSaw
LFSaw / Ndef.scd
Created July 29, 2011 18:13
Cadavre Excuis
(
Ndef('gistCadavre', {SplayAz.ar(2, SinOsc.ar({LFDNoise3.ar(Rand(0.1, 0.4)).exprange(20, 200)}!20, 0, 5).tanh, spread: 2, orientation: WhiteNoise.ar.lag(LFDNoise3.ar(pi.reciprocal).exprange(0.000001, 0.001))).tanh});
Ndef('gistCadavre').set('fadeTime', 2);
);
@LFSaw
LFSaw / inject.scd
Created August 5, 2011 21:33
use inject to sum up values in an array #scTip

// first argument is the start value // second argument is the function, which is evaluated with the last value as first argument and the current value as the second.

[1, 23, 42].inject(0, {|last, current| last + current})

@LFSaw
LFSaw / tip.scd
Created August 5, 2011 22:35
how to separate arrayed return values #scTip
// a function that returns the first element of an array plus all other elements
f = {|anArray| [anArray.first, anArray[1..]]}
// a will contain the first element, b, the remaining array
#a, b = f.([1, 2, 3, 4, 5])
@LFSaw
LFSaw / tip.scd
Created August 6, 2011 11:31
Implementation of Array:maxItem with inject. #scTip
// Interestingly, the regular maxItem is twice as fast as this much more elegant version.
// However, you can learn a lot by trying to solve and reimplement common methods with e.g. inject.
f = {|a| a.inject(a.first, {|last, current|
max(current, last)
})}
// an example array