Skip to content

Commit

Permalink
Upgraded to 1.2.1.3. Ported String funcs. Removed my File I/O stuff s…
Browse files Browse the repository at this point in the history
…ince ChucK has that now.
  • Loading branch information
Jim Menard committed Oct 5, 2009
1 parent f16c8c9 commit 5d9256c
Show file tree
Hide file tree
Showing 71 changed files with 4,782 additions and 728 deletions.
7 changes: 5 additions & 2 deletions AUTHORS
Expand Up @@ -7,17 +7,18 @@ Chief Architect and Design:
Ge Wang

Developers:
Ge Wang (gewang@cs.princeton.edu | ge@ccrma.stanford.edu)
Ge Wang (ge@ccrma.stanford.edu | gewang@cs.princeton.edu)
Perry Cook (prc@cs.princeton.edu)
Ananya Misra (amisra@cs.princeton.edu)
Spencer Salazar (ssalazar@cs.princeton.edu)
Rebecca Fiebrink (fiebrink@cs.princeton.edu)
Ananya Misra (amisra@cs.princeton.edu)
Ari Lazier (alazier@cs.princeton.edu)
Philip Davidson (philipd@alumni.princeton.edu)
Dan Trueman (dan@music.princeton.edu)

Lead Test:
Ge Wang
Spencer Salazar
Philip Davidson
Ajay Kapur

Expand All @@ -39,3 +40,5 @@ ChucK home page:
Princeton Sound Lab:
http://soundlab.cs.princeton.edu/

CCRMA:
http://ccrma.stanford.edu/
1 change: 1 addition & 0 deletions DEVELOPER
Expand Up @@ -8,5 +8,6 @@ current version of this document:
chuck home:

http://chuck.cs.princeton.edu/
http://chuck.stanford.edu/

---
13 changes: 7 additions & 6 deletions INSTALL
Expand Up @@ -6,12 +6,13 @@ version: 1.2.x.x (dracula)

ChucK home:
http://chuck.cs.princeton.edu/
http://chuck.stanford.edu/

Got questions?
http://chuck.cs.princeton.edu/community.html

email us:
gewang@cs.princeton.edu
gewang@cs.princeton.edu | ge@ccrma.stanford.edu

online version of this document:
http://chuck.cs.princeton.edu/doc/build/
Expand Down Expand Up @@ -63,18 +64,18 @@ directory name):

%> make
[chuck build]: please use one of the following configurations:
make osx-ppc, make osx-intel, make win32,
make osx, make osx-ub, make win32,
make linux-oss, make linux-alsa, or make linux-jack

Now, type the command corresponding to your platform...

for example, for MacOS X (PowerPC):
for example, for MacOS X (Universal Binary: PowerPC + Intel):

%> make osx-ppc
%> make osx-ub

or for MacOS X (Intel):
or for MacOS X (current):

%> make osx-intel
%> make osx

etc...

Expand Down
10 changes: 6 additions & 4 deletions README
@@ -1,7 +1,5 @@
Note: this is a fork of ChucK. I'm slowing adding some very small features.

I've also added the "-arch i386" flag to the compile and link phases in
makefile.osx. Without it, compilation on Mac OS X Snow Leopard is hopeless.
Note: this is a fork of ChucK 1.2.1.3 (dracula). I'm slowing adding some very
small features. Right now, I've implemented String.ch and added String.substr.

-- Jim Menard, jimm@io.com

Expand Down Expand Up @@ -39,13 +37,17 @@ authors:

ChucK home page:
http://chuck.cs.princeton.edu/
http://chuck.stanford.edu/

ChucK documentation:
http://chuck.cs.princeton.edu/doc/

Princeton Sound Lab:
http://soundlab.cs.princeton.edu/

CCRMA:
http://ccrma.stanford.edu/

---

*** QUICK START ***
Expand Down
4 changes: 3 additions & 1 deletion THANKS
Expand Up @@ -15,6 +15,8 @@ Ken Steiglitz
Paul Lansky
Roger Dannenberg
Max Mathews
Chris Chafe
Fernando Lopez-Lezcano
n++k
Nick Collins
Niklas Werner
Expand All @@ -26,7 +28,7 @@ Adam Wendt
Gary Scavone
Brad Garton
Graham Coleman
Kassen
Kassen Oud
Kijjaz
Scott Smallwood
Mark Daly
Expand Down
42 changes: 42 additions & 0 deletions VERSIONS
@@ -1,3 +1,44 @@
---
1.2.1.3
- (added) initial/experimental support for file I/O (finally)
(thanks to Andrew Schran, Martin Robinson)
- (added) new class: IO, FileIO
see examples/io/:
read-int.ck
read-str.ck
readline.ck - using readline
write.ck - write using <=
write2.ck - write using .write()
- (added) IO input via =>
- (added) IO output via <= (the "back-chuck")
example: fio <= x <= " " <= y <= "\n";
- (added) new syntax for checking if/while/for/until with IO objects
e.g., while( fio => i ) { ... }
- (added) StdOut/StdErr objects:
"chout" (pronounced "shout")
"cherr" (pronounced "Cher")
- (added) Hid.open() now can accept a device name parameter
- (added) analysis/tracking examples are now back
(thanks to Kassen for looking into this)
- (fixed) calling overloaded functions with most specific match
e.g., Specific extends General:
fun void foo( General obj ) { }
fun void foo( Specific obj ) { }
foo( obj $ Specific ); // should call foo( Specific )
(thanks to Robert Poor for reporting, to Kassen, David Rush,
Michael Heuer, and Andrew C. Smith for follow-up)
- (fixed) STK instruments control changes reports range issues as
"control value exceeds nominal range"; previously printed
hard-coded values that were potentially misleading
(thanks to Kassen for reporting)
- (fixed) all oscillators now produce audio for negative frequencies
(thanks to Luke Dahl)
- (fixed) incorrect UGen disconnect (thanks Kassen for reporting)
- (fixed) type checker now validates if/while/for/until types
- (fixed) linux compilation (for gcc 4.x)
- (fixed) complilation on OS X Snow Leopard


---
1.2.1.2
- (added) dynamic, resizable arrays
Expand Down Expand Up @@ -55,6 +96,7 @@
- (fixed) unsporked Shred instances now given id == 0 (thanks Kassen)
- (fixed) typos in ugen_xxx.cpp and chuck-specific rtaudio.cpp (/moudi)


---
1.2.1.1
- (fixed) ctrl-c no longer causes crash on shutdown
Expand Down
Binary file modified doc/ChucK_manual.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions doc/GOTO
Expand Up @@ -4,3 +4,4 @@ ChucK Documentation + Tutorials:

ChucK home:
http://chuck.cs.princeton.edu/
http://chuck.stanford.edu/
71 changes: 71 additions & 0 deletions examples/analysis/tracking/Smacking.ck
@@ -0,0 +1,71 @@
//--
// name: Smacking.ck
// desc: class and process for tracking smack events from sudden motion sensor
// only works with SMS-enabled laptops
//
// author: Rebecca Fiebrink + Ge Wang
// date: 2007
//--


// public class
public class Smacking
{
static Event @ the_event;
}

// initialize separately (due to a bug)
new Event @=> Smacking.the_event;

// smack detection threshold (less -> more sensitive)
15 => int threshold;
// pol rate
.01::second => dur poll_rate;
// recover time (after smack detection)
.10::second => dur recover_time;

// instantiate a HidIn object
HidIn hi;
HidMsg msg;

// open tilt sensor
if( !hi.openTiltSensor() )
{
<<< "tilt sensor unavailable", "" >>>;
me.exit();
}

// "doh"
<<< "hit me!", "" >>>;

// remember
HidMsg last;
// initialize
hi.read( 9, 0, last );

// infinite event loop
while( true )
{
// poll the tilt sensor, expect to get back 3 element array of ints
hi.read( 9, 0, msg );

// compute difference
(Math.abs(msg.x - last.x) + Math.abs(msg.y - last.y) + Math.abs(msg.z - last.z)) => int diff;
// check threshold
if (diff > threshold) {
// smack detected!
// <<< "ouch!" >>>;
// fire!
Smacking.the_event.broadcast();
// go
recover_time => now;
} else {
// uncomment the following to dynamically calibrate the smack sensor
// msg.x => last.x;
// msg.y => last.y;
// msg.z => last.z;

// advance
poll_rate => now;
}
}
63 changes: 63 additions & 0 deletions examples/analysis/tracking/Tracking.ck
@@ -0,0 +1,63 @@
//--
// name: Tracking.ck
// desc: class and process for tracking a peak and amplitutde via FFT
// the Tracking class can be accessed from external shreds
//
// author: Ge Wang + Rebecca Fiebrink
// date: 2007
//--


// public class
public class Tracking
{
static float the_freq;
static float the_gain;
static Event @ the_event;
}

// initialize separately (due to a bug)
new Event @=> Tracking.the_event;

// analysis
adc => PoleZero dcblock => FFT fft => blackhole;

// set to block DC
.99 => dcblock.blockZero;
// set FFT params
2048 => fft.size;
// window
Windowing.hamming( fft.size() ) => fft.window;

// go for it
while( true )
{
// take fft
fft.upchuck() @=> UAnaBlob blob;

// find peak
0 => float max; float where;
for( int i; i < blob.fvals().cap()/8; i++ )
{
// compare
if( blob.fvals()[i] > max )
{
// save
blob.fvals()[i] => max;
i => where;
}
}

// set freq
(where / fft.size() * (second / samp)) => Tracking.the_freq;
// set gain
(max / .5) => Tracking.the_gain;
// clamp
if( Tracking.the_gain > 1 )
1 => Tracking.the_gain;
// fire!
Tracking.the_event.broadcast();

// hop
(fft.size()/4)::samp => now;
}
68 changes: 68 additions & 0 deletions examples/analysis/tracking/harm.ck
@@ -0,0 +1,68 @@
//--
// name: harm.ck
// desc: using Tracking and Smacking to harmonize
//
// author: Rebecca Fiebrink + Ge Wang
// date: 2007
//--


// synthesis
BlitSaw s => JCRev r => dac;
4 => s.harmonics;

// set reverb mix
.05 => r.mix;
// possible hamonizing intervals
[ 3-24, 4-12, 7, 9+12 ] @=> int harms[];
float the_harm;

// interpolate
float target_freq, curr_freq, target_gain, curr_gain;
spork ~ ramp_stuff();
spork ~ smack_handler();

// go for it
while( true )
{
// wait for analysis event
Tracking.the_event => now;

// set freq
Tracking.the_freq * Math.pow(1.059, the_harm) => target_freq;
// set gain
Tracking.the_gain => target_gain;
}

// interpolation
fun void ramp_stuff()
{
// mysterious 'slew'
0.025 => float slew;

// infinite time loop
while( true )
{
(target_freq - curr_freq) * 1 * slew + curr_freq => curr_freq => s.freq;
(target_gain - curr_gain) * .25 * slew + curr_gain => curr_gain => s.gain;
0.0025::second => now;
}
}

// handles smack
fun void smack_handler()
{
// go
while( true )
{
// wait
Smacking.the_event => now;

// choose random interval
harms[Std.rand2(0,harms.cap()-1)] => the_harm;
// set freq
Tracking.the_freq * Math.pow(1.059, the_harm) => target_freq;
// print
<<< "new interval:", the_harm >>>;
}
}

0 comments on commit 5d9256c

Please sign in to comment.