Permalink
Browse files

Back to class Csound. Examples work again.

  • Loading branch information...
jacobjoaquin committed Aug 17, 2010
1 parent f6dfba1 commit 8bb426e6214c4db86dfb26ff6d74927db44a1ba9
@@ -7,7 +7,10 @@ nchnls = 1
0dbfs = 1
gi_sin ftgen 1, 0, 8192, 10, 1
-;gi_foo ftgen 20, 0, 8192, 10, 1
+
+chn_k "amp", 1
+
+chnset 0.5, "amp"
instr 1
; Keep Csound running
@@ -18,32 +21,17 @@ instr 2
iamp = p4
ifreq = p5
- k1 line iamp, idur, 0
- a1 oscil k1, ifreq, gi_sin
+ k2 chnget "amp"
- out a1
-endin
-
-instr 3
- turnoff2 4, 0, 0
- turnoff
-endin
-
-instr 4
- idur = p3
- iamp = p4
- ifreq = p5
-
- a1 foscil iamp, ifreq, 1, 2, 1, gi_sin
+ k1 line iamp, idur, 0
+ a1 oscil k1 * k2, ifreq, gi_sin
out a1
endin
-
</CsInstruments>
<CsScore>
i 1 0 [60 * 60 * 24]
i 2 0 4 0.5 262
-
</CsScore>
</CsoundSynthesizer>
@@ -3,46 +3,24 @@ import csoundo.*;
Csoundo cs;
void setup() {
- size(1600, 1200);
+ size(720, 480);
frameRate(30);
- smooth();
background(0);
-// noLoop();
cs = new Csoundo(this, "data/synth.csd");
cs.run();
+ cs.tableSetTest(1, 2048, -1.0);
}
void draw() {
- fill(0, 16);
- rect(0, 0, width, height);
- ellipseMode(RADIUS);
- noStroke();
+ if (frameCount % 9 == 0) {
+ cs.event("i 2 0 0.3 0.5 " + (random(440.0) + 440));
+ }
-// float r = random(255.0);
-// fill(r, r, 196);
-
- println("before");
- float size = pow(2, 11);
- println(size);
- cs.event("f 20 0 " + size + " 10 0");
- println("after");
- int length = cs.tableLength(20);
- float phase = (float) (frameCount % 120) / 120 * TWO_PI;
- for (int i = 0; i < length; i++) {
- float r = random(255.0);
- fill(r, r, 255, 196);
- cs.tableSet(20, length - i - 1, sin(2 * PI * (float) i *
- (random(0.2) + 1.0) / (float) length + phase));
- float v = cs.tableGet(20, length - i - 1);
-
- float r1 = random(2.0);
- float r2 = random(2.0);
-
- ellipse((float) i / (float) length * (float) width,
- height / 2.0 + height / 2.0 * v, r1, r1);
+ println(cs.tableLengthTest(1));
+
+ if (frameCount % 5 == 0) {
+ cs.setChn("amp", random(1.0));
}
-// float v = cs.tableGet(20, (length - 1));
-// print("done " + v);
}
@@ -10,7 +10,10 @@ nchnls = 1
0dbfs = 1
gi_sin ftgen 1, 0, 8192, 10, 1
-;gi_foo ftgen 20, 0, 8192, 10, 1
+
+chn_k "amp", 1
+
+chnset 0.5, "amp"
instr 1
; Keep Csound running
@@ -21,33 +24,18 @@ instr 2
iamp = p4
ifreq = p5
- k1 line iamp, idur, 0
- a1 oscil k1, ifreq, gi_sin
+ k2 chnget "amp"
- out a1
-endin
-
-instr 3
- turnoff2 4, 0, 0
- turnoff
-endin
-
-instr 4
- idur = p3
- iamp = p4
- ifreq = p5
-
- a1 foscil iamp, ifreq, 1, 2, 1, gi_sin
+ k1 line iamp, idur, 0
+ a1 oscil k1 * k2, ifreq, gi_sin
out a1
endin
-
</CsInstruments>
<CsScore>
i 1 0 [60 * 60 * 24]
i 2 0 4 0.5 262
-
</CsScore>
</CsoundSynthesizer>
@@ -0,0 +1,109 @@
+Message From Another Planet
+Jacob Joaquin
+Spring 1999
+Revision June 2, 2010
+jacobjoaquin@gmail.com
+csoundblog.com
+
+
+To search for extraterrestrial intelligence from your home computer visit
+http://setiathome.berkeley.edu/
+
+
+Bio
+
+Jacob Joaquin started tinkering with music on a Commodore 64 while
+in elementary school. From 1994 - 1996 he ran the Digital Dissonance
+BBS, an online Fresno community where musicians traded original
+tracker-based electronic compositions. He received his BA in Music
+Synthesis from Berklee College of Music in 1999. During his time
+at Berklee he recieved his first C programming lesson from Max
+Mathews and was the first recipient of Berklee's Max Mathews' award.
+Jacob completed his Masters Degree in Composition New Media and
+Integrated Media at California Institute of the Arts in 2002. He
+has studied composition with Dr. Richard Boulanger, Mark Trayle and
+Morton Subotnick.
+
+
+<CsoundSynthesizer>
+<CsInstruments>
+sr = 44100
+kr = 44100
+ksmps = 1
+nchnls = 2
+0dbfs = 1
+
+; Shape of cycling envelope
+gi_env ftgen 0, 0, 32768, 7, 0, 2048, 1, 30720, 0
+
+instr M
+ iamp = p4 ; Amplitude
+ iratio = p5 ; Frequency ratio
+ icycle = p6 ; Rate of cycling envelope
+
+ iamp_mod = ((iratio + 1) / iratio) * 0.5
+ ifreq = 440 * 2 ^ (-9 / 12) * iratio
+
+ ; Cycling envelope
+ k2 expseg 0.0625, 15, 0.0625, 113, 3.75, 113, 0.03125, 15, 0.0625
+ k1 phasor icycle * k2
+ k1 tablei ftlen(gi_env) * k1, gi_env, 0, 0, 1
+
+ ; Random panner
+ krand randi 0.5, icycle * 5, rnd(1), 1, 0.5
+
+ ; Sine wave oscillator
+ a1 oscils iamp * iamp_mod, ifreq, 0, 2
+ a1 = a1 * k1
+
+ ; Output to chn bus
+ chnmix a1 * sqrt(krand), "left"
+ chnmix a1 * (sqrt(1 - krand)), "right"
+endin
+
+instr Mixer
+ iamp = p4 ; Amplitude
+
+ aleft chnget "left"
+ aright chnget "right"
+ aenv linseg iamp, 240, iamp, 16, 0
+
+ outs aleft * aenv, aright * aenv
+
+ chnclear "left"
+ chnclear "right"
+endin
+
+</CsInstruments>
+<CsScore>
+i "M" 0 256 1 1 1.24
+i "M" 0 . . 1.0666 1.23
+i "M" 0 . . 1.125 1.22
+i "M" 0 . . 1.14285 1.21
+i "M" 0 . . 1.23076 1.20
+i "M" 0 . . 1.28571 1.19
+i "M" 0 . . 1.333 1.18
+i "M" 0 . . 1.4545 1.17
+i "M" 0 . . 1.5 1.16
+i "M" 0 . . 1.6 1.15
+i "M" 0 . . 1.777 1.14
+i "M" 0 . . 1.8 1.13
+i "M" 0 . . 2 1.12
+i "M" 0 . . 2.25 1.10
+i "M" 0 . . 2.28571 1.09
+i "M" 0 . . 2.666 1.08
+i "M" 0 . . 3 1.07
+i "M" 0 . . 3.2 1.06
+i "M" 0 . . 4 1.05
+i "M" 0 . . 4.5 1.04
+i "M" 0 . . 5.333 1.03
+i "M" 0 . . 8 1.02
+i "M" 0 . [1 / 3] 9 1.01
+i "M" 0 . [1 / 6] 16 1.00
+
+i "Mixer" 0 256 0.1058362578313075
+
+e 256
+</CsScore>
+</CsoundSynthesizer>
+
@@ -0,0 +1,49 @@
+<CsoundSynthesizer>
+<CsInstruments>
+sr = 44100
+kr = 1470
+ksmps = 30
+nchnls = 1
+0dbfs = 1
+
+gi_sin ftgen 1, 0, 8192, 10, 1
+;gi_foo ftgen 20, 0, 8192, 10, 1
+
+instr 1
+ ; Keep Csound running
+endin
+
+instr 2
+ idur = p3
+ iamp = p4
+ ifreq = p5
+
+ k1 line iamp, idur, 0
+ a1 oscil k1, ifreq, gi_sin
+
+ out a1
+endin
+
+instr 3
+ turnoff2 4, 0, 0
+ turnoff
+endin
+
+instr 4
+ idur = p3
+ iamp = p4
+ ifreq = p5
+
+ a1 foscil iamp, ifreq, 1, 2, 1, gi_sin
+
+ out a1
+endin
+
+
+</CsInstruments>
+<CsScore>
+i 1 0 [60 * 60 * 24]
+i 2 0 4 0.5 262
+
+</CsScore>
+</CsoundSynthesizer>
@@ -0,0 +1,53 @@
+<CsoundSynthesizer>
+<CsOptions>
+-d -odac /Users/clu/Documents/workspace/Csoundo/examples/devScratchPad/data/temp.csd
+</CsOptions>
+<CsInstruments>
+sr = 44100
+kr = 1470
+ksmps = 30
+nchnls = 1
+0dbfs = 1
+
+gi_sin ftgen 1, 0, 8192, 10, 1
+;gi_foo ftgen 20, 0, 8192, 10, 1
+
+instr 1
+ ; Keep Csound running
+endin
+
+instr 2
+ idur = p3
+ iamp = p4
+ ifreq = p5
+
+ k1 line iamp, idur, 0
+ a1 oscil k1, ifreq, gi_sin
+
+ out a1
+endin
+
+instr 3
+ turnoff2 4, 0, 0
+ turnoff
+endin
+
+instr 4
+ idur = p3
+ iamp = p4
+ ifreq = p5
+
+ a1 foscil iamp, ifreq, 1, 2, 1, gi_sin
+
+ out a1
+endin
+
+
+</CsInstruments>
+<CsScore>
+i 1 0 [60 * 60 * 24]
+i 2 0 4 0.5 262
+
+
+</CsScore>
+</CsoundSynthesizer>
@@ -0,0 +1,16 @@
+import csoundo.*;
+
+Csoundo cs;
+
+void setup() {
+ size(1600, 1200);
+ background(0);
+ noLoop();
+
+ cs = new Csoundo(this, "data/message_from_another_planet.csd");
+ cs.run();
+}
+
+void draw() {
+
+}
Oops, something went wrong.

0 comments on commit 8bb426e

Please sign in to comment.