Skip to content

11 small differences between sc and cc

mohayonao edited this page Dec 7, 2013 · 2 revisions

Calling a function with no arguments

A function of CoffeeCollider cannot omit parenthese when calling with no arguments.

// SuperCollider
69.midicps(); // 440
69.midicps;   // 440
# CoffeeCollider
69.midicps() # 440
69.midicps   # [Function]

pi is a function

// SuperCollider
10pi // 31.415926535898
10.pi()                   # 31.415926535898
[ 1, 2, 3 ].pi()          # [ 3.1415926535, 6.2831853071, 9.424777960 ]
Line.kr(0, 2, dur:1).pi() # 1秒かけて 0 から 2pi まで変化する

Adverbs for Binary Operators

// SuperCollider
[ 1, 2, 3 ] + [ 10, 20 ]   // [ 11, 22, 13 ]
[ 1, 2, 3 ] +.s [ 10, 20 ] // [ 11, 22 ]
(1..100) max:.f [ 10, 20, 30 ]
# CoffeeCollider
[ 1, 2, 3 ] + [ 10, 20 ]   # [ 11, 22, 13 ]
[ 1, 2, 3 ] +S+ [ 10, 20 ] # [ 11, 11 ]
[1..100].max([ 10, 20, 30 ], FOLD)

Types of Numbers

// SuperCollider
rrand(0, 10.0) // return a Float
rrand(0, 10)   // return an Integer
# CoffeeCollider
rrand(0, 10)         # return a Float
rrand(0, 10).asInt() # return an Integer

Order of operations

// SuperCollider
1 + 2 * 3 // (1 + 2) * 3 -> 9
# CoffeeCollider
1 + 2 * 3 # 1 + (2 * 3) -> 7

Literals

// SuperCollider
nil
inf
# CoffeeCollider
null
Infinity

Global Variants

// SuperCollider
a = 10; // global
# CoffeeCollider
$a = 10 # global
Clone this wiki locally