// this is a comment

39 + 3  // evaluate this by pressing [ENTER] (OSX) or [CTRL-RETURN] (Win)

// more complicated math to evaluate ...

9.sqrt
3.squared
3.cubed

1/3
3.reciprocal

1/0
inf.reciprocal

2 ** 8

(1 + 5.sqrt) / 2   // the Golden Mean

pi

4 == 4		
4 == 5
4 < 7		
4 > 7

// ... even more complicated but "musical" math:

2.pow(1/12)		// a musical semitone interval in equal-tempered tuning

2 ** (1/2)		// an equal-tempered tritone 
	
7/5				// a "tritone" in the harmonic series

(3 ** 6) / (2 ** 9) // a tritone in Pythagorean tuning

3.pow(2) * 5.pow(1) * 2.pow(-5) // a tritone in just intonation

440 * 2.pow((60-69)/12)		// calculation of the frequency of the middle c
60.midicps				// the more comfortable way to do this in SC

log2(1000/440) * 12 + 69	// what pitch relates to a frequency of 1000 Hz ?
1000.cpsmidi				// the more comfortable way to do this in SC

(3/2).ratiomidi			// the number of semitones related to a perfect fifth
7.midiratio				// the ratio (as floating point number) related to an interval of 7 semitones
7.midiratio.asFraction		// find a near ratio of integers

((1 + 5.sqrt) / 2).ratiomidi // which is the musical interval of the Golden Mean ?
(pi/2).ratiomidi			 // which is the interval of Pi/2 ?

// the frequencies of a major scale on C (given in MIDI semitone numbers)
[60, 62, 64, 65, 67, 69, 71, 72].midicps

// ... more readable
[60, 62, 64, 65, 67, 69, 71, 72].midicps.round(0.01)

// when we write it like this it's easier to transpose
([0, 2, 4, 5, 7, 9, 11, 12] + 60).midicps.round(0.01)
([0, 2, 4, 5, 7, 9, 11, 12] + 62).midicps.round(0.01)

// ... and easier to change the scale
([0, 2, 3, 5, 7, 8, 10, 12] + 60).midicps.round(0.01)

// what are the MIDI note numbers of the first 8 harmonics on the middle c ?
(60.midicps * [1,2,3,4,5,6,7,8]).cpsmidi.round(0.01)

// ... the same in a simpler notation
(1 .. 8).ratiomidi.round(0.01) + 60