Author Message

jbum







Joined: Oct 24, 2006

Posts: 26

Location: Los Angeles Joined: Oct 24, 2006Posts: 26Location: Los Angeles

Posted: Fri Nov 03, 2006 3:27 pm Post subject: 'In C' by Terry Riley

Subject description: A ChucK implementation using randomly repeated phrases I'm sporking this discussion from another thread... Thought it merited it's own subject line...



UPDATE: Corrected the midi note conversrion using Std.mtof().



Code:

// ChucK Performance of Terry Riley's 'In C'

//

// In this famous canon by composer Terry Riley, each performer is given the

// same set of phrases.

//

// Each performer repeats each phrase a random number of times before moving

// on to the next phrase.

//

// A single player keeps time by playing a pulse beat

// When all the players are done, the pulse continues for a while, and then stops.

//

// ChucK port 11/2006 -- Jim Bumgardner

// Original Perl Program 9/2004 -- Jim Bumgardner





// With these settings, ChucK produces about 14 minutes of music.

// A more typical 'In C' performance is 20-60 minutes. Increase the

// min/max repetitions to achieve this...

//

240 => float bps; // ticks/second

4 => int minRepeats; // minimum times to repeat a phrase

10 => int maxRepeats; // maximum times to repeat a phrase



[new StifKarp,

new StifKarp,

new StifKarp,

new StifKarp,

new StifKarp,

new StifKarp,

new Mandolin,

new Mandolin,

new Mandolin,

new Mandolin,

new Mandolin] @=> StkInstrument players[];



1.0/players.cap() => float mainGain;



[

// midi pitch, vol, start-ticks, dur-ticks

[72, 50, 0, 48],

[72, 50, 48, 48],

[72, 50, 96, 48],

[72, 50, 144, 48],

[72, 50, 192, 48],

[72, 50, 240, 48],

[72, 50, 288, 48],

[72, 50, 336, 48]

] @=> int pulsePhrase[][];



// Phrases transcribed from 'In C' by Terry Riley

[

[

// midi pitch, vol, start-ticks, dur-ticks

[0, 63, 0, 96]

],

[

[60, 63, 0, 6],

[64, 63, 6, 90],

[60, 63, 96, 6],

[64, 63, 102, 90],

[60, 63, 192, 6],

[64, 63, 198, 90]

],

[

[60, 63, 0, 6],

[64, 63, 6, 42],

[65, 63, 48, 48],

[64, 63, 96, 96]

],

[

[0, 63, 0, 48],

[64, 63, 48, 48],

[65, 63, 96, 48],

[64, 63, 144, 48]

],

[

[0, 63, 0, 48],

[64, 63, 48, 48],

[65, 63, 96, 48],

[67, 63, 144, 48]

],

[

[64, 63, 0, 48],

[65, 63, 48, 48],

[67, 63, 96, 48],

[0, 63, 144, 48]

],

[

[72, 63, 0, 768]

],

[

[0, 63, 0, 336],

[60, 63, 336, 24],

[60, 63, 360, 24],

[60, 63, 384, 48],

[0, 63, 432, 432]

],

[

[67, 63, 0, 576],

[65, 63, 576, 768]

],

[

[71, 63, 0, 24],

[67, 63, 24, 24],

[0, 63, 48, 336]

],

[

[71, 48, 0, 24],

[67, 48, 24, 24]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24],

[71, 48, 48, 24],

[67, 48, 72, 24],

[71, 48, 96, 24],

[67, 48, 120, 24]

],

[

[65, 63, 0, 48],

[67, 63, 48, 48],

[71, 63, 96, 384],

[72, 63, 480, 96]

],

[

[71, 63, 0, 24],

[67, 63, 24, 72],

[67, 63, 96, 24],

[65, 63, 120, 24],

[67, 63, 144, 48],

[0, 63, 192, 72],

[67, 63, 264, 312]

],

[

[72, 63, 0, 384],

[71, 63, 384, 384],

[67, 63, 768, 384],

[66, 63, 1152, 384]

],

[

[67, 63, 0, 24],

[0, 63, 24, 360]

],

[

[67, 48, 0, 24],

[71, 48, 24, 24],

[72, 48, 48, 24],

[71, 48, 72, 24]

],

[

[71, 48, 0, 24],

[72, 48, 24, 24],

[71, 48, 48, 24],

[72, 48, 72, 24],

[71, 48, 96, 24],

[0, 48, 120, 24]

],

[

[64, 48, 0, 24],

[66, 48, 24, 24],

[64, 48, 48, 24],

[66, 48, 72, 24],

[64, 48, 96, 72],

[64, 48, 168, 24]

],

[

[0, 63, 0, 144],

[67, 63, 144, 144]

],

[

[64, 48, 0, 24],

[66, 48, 24, 24],

[64, 48, 48, 24],

[66, 48, 72, 24],

[55, 48, 96, 72],

[64, 48, 168, 24],

[66, 48, 192, 24],

[64, 48, 216, 24],

[66, 48, 240, 24],

[64, 48, 264, 24]

],

[

[66, 63, 0, 288]

],

[

[64, 63, 0, 144],

[64, 63, 144, 144],

[64, 63, 288, 144],

[64, 63, 432, 144],

[64, 63, 576, 144],

[66, 63, 720, 144],

[67, 63, 864, 144],

[69, 63, 1008, 144],

[71, 63, 1152, 48]

],

[

[64, 63, 0, 48],

[66, 63, 48, 144],

[66, 63, 192, 144],

[66, 63, 336, 144],

[66, 63, 480, 144],

[66, 63, 624, 144],

[67, 63, 768, 144],

[69, 63, 912, 144],

[71, 63, 1056, 96]

],

[

[64, 63, 0, 48],

[66, 63, 48, 48],

[67, 63, 96, 144],

[67, 63, 240, 144],

[67, 63, 384, 144],

[67, 63, 528, 144],

[67, 63, 672, 144],

[69, 63, 816, 144],

[71, 63, 960, 48]

],

[

[64, 63, 0, 48],

[66, 63, 48, 48],

[67, 63, 96, 48],

[69, 63, 144, 144],

[69, 63, 288, 144],

[69, 63, 432, 144],

[69, 63, 576, 144],

[69, 63, 720, 144],

[71, 63, 864, 144]

],

[

[64, 63, 0, 48],

[66, 63, 48, 48],

[67, 63, 96, 48],

[69, 63, 144, 48],

[71, 63, 192, 144],

[71, 63, 336, 144],

[71, 63, 480, 144],

[71, 63, 624, 144],

[71, 63, 768, 144]

],

[

[64, 48, 0, 24],

[66, 48, 24, 24],

[64, 48, 48, 24],

[66, 48, 72, 24],

[67, 48, 96, 48],

[64, 48, 144, 24],

[67, 48, 168, 24],

[66, 48, 192, 24],

[64, 48, 216, 24],

[66, 48, 240, 24],

[64, 48, 264, 24]

],

[

[64, 48, 0, 24],

[66, 48, 24, 24],

[64, 48, 48, 24],

[66, 48, 72, 24],

[64, 48, 96, 72],

[64, 48, 168, 24]

],

[

[64, 63, 0, 288],

[67, 63, 288, 288],

[72, 63, 576, 288]

],

[

[72, 63, 0, 576]

],

[

[67, 48, 0, 24],

[65, 48, 24, 24],

[67, 48, 48, 24],

[71, 48, 72, 24],

[67, 48, 96, 24],

[71, 48, 120, 24]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24],

[65, 48, 48, 24],

[67, 48, 72, 24],

[71, 48, 96, 24],

[65, 48, 120, 312],

[67, 48, 432, 144]

],

[

[67, 63, 0, 24],

[65, 63, 24, 24],

[0, 63, 48, 48]

],

[

[67, 48, 0, 24],

[65, 48, 24, 24]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24],

[71, 48, 48, 24],

[67, 48, 72, 24],

[71, 48, 96, 24],

[67, 48, 120, 24],

[71, 48, 144, 24],

[67, 48, 168, 24],

[71, 48, 192, 24],

[67, 48, 216, 24],

[0, 48, 240, 336],

[70, 63, 576, 96],

[79, 63, 672, 288],

[81, 63, 960, 48],

[79, 63, 1008, 96],

[83, 63, 1104, 48],

[81, 63, 1152, 144],

[79, 63, 1296, 48],

[76, 63, 1344, 288],

[79, 63, 1632, 48],

[78, 63, 1680, 336],

[0, 63, 2016, 240],

[76, 63, 2256, 240],

[77, 63, 2496, 576]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24],

[71, 48, 48, 24],

[67, 48, 72, 24],

[71, 48, 96, 24],

[67, 48, 120, 24]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24],

[71, 48, 48, 24]

],

[

[71, 48, 0, 24],

[67, 48, 24, 24],

[65, 48, 48, 24],

[67, 48, 72, 24],

[71, 48, 96, 24],

[72, 48, 120, 24]

],

[

[71, 48, 0, 24],

[65, 48, 24, 24]

],

[

[71, 48, 0, 24],

[67, 48, 24, 24]

],

[

[72, 63, 0, 384],

[71, 63, 384, 384],

[69, 63, 768, 384],

[72, 63, 1152, 384]

],

[

[65, 48, 0, 96],

[64, 48, 96, 96],

[65, 48, 192, 96],

[64, 48, 288, 96],

[64, 48, 384, 48],

[64, 48, 432, 48],

[64, 48, 480, 48],

[65, 48, 528, 24],

[64, 48, 552, 24]

],

[

[77, 63, 0, 48],

[76, 63, 48, 96],

[76, 63, 144, 48],

[72, 63, 192, 96]

],

[

[74, 63, 0, 96],

[74, 63, 96, 96],

[67, 63, 192, 96]

],

[

[67, 48, 0, 24],

[74, 48, 24, 24],

[76, 48, 48, 24],

[74, 48, 72, 24],

[0, 48, 96, 48],

[67, 48, 144, 48],

[0, 48, 192, 48],

[67, 48, 240, 48],

[0, 48, 288, 48],

[67, 48, 336, 48],

[67, 48, 384, 24],

[74, 48, 408, 24],

[76, 48, 432, 24],

[74, 48, 456, 24]

],

[

[74, 63, 0, 24],

[76, 63, 24, 24],

[74, 63, 48, 48]

],

[

[67, 63, 0, 576],

[67, 63, 576, 384],

[65, 63, 960, 480]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24],

[70, 48, 48, 24],

[67, 48, 72, 24],

[70, 48, 96, 24],

[67, 48, 120, 24]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24]

],

[

[65, 48, 0, 24],

[67, 48, 24, 24],

[70, 48, 48, 24]

],

[

[67, 48, 0, 24],

[70, 48, 24, 24]

],

[

[70, 48, 0, 24],

[67, 48, 24, 24]

]

] @=> int phraseList[][][];



players.cap() => int playersIn;

1 => int pulseIsPlaying;



fun int phraseLength(int ph[][])

{

return ph[ph.cap()-1][2] + ph[ph.cap()-1][3];

}





fun void playPhrase(int ph[][], StkInstrument voc)

{

for (0 => int i; i < ph.cap(); ++i)

{

if (ph[i][0] > 0) {

// convert midi-note to frequency

Std.mtof(ph[i][0]) => voc.freq;

// convert midi-vol to gain (and randomize it a bit)

(mainGain*ph[i][1]+Std.rand2(0,9)-4)/127.0 => voc.gain;

}

else {

// rest

0 => voc.gain;

}

1 => voc.noteOn;

// wait til next note...

(ph[i][3]/bps)::second => now;

1 => voc.noteOff;

if (i+1 < ph.cap())

{

if ((ph[i+1][2] - ph[i][2]) > ph[i][3])

((ph[i+1][2] - (ph[i][2]+ph[i][3]))/bps)::second => now;

}

}

}



// Repeat a particular phrase N times

fun void repeatPhrase(int ph[][], int n, int player)

{

if (player >= players.cap())

{

<<< "Bad Player!" >>>;

}



players[player] @=> StkInstrument voc;

0 => voc.gain;

20 => voc.freq;

phraseLength(ph) => float totBeats;

for (0 => int pp; pp < n; ++pp)

{

playPhrase(ph, voc);

}

}



// Performance by a single player

// play each phrase a random number of times

fun void doRileyPart(int player)

{

for (0 => int p; p < phraseList.cap(); ++p)

{

Std.rand2(minRepeats,maxRepeats) => int nTimes;

repeatPhrase(phraseList[p], nTimes, player);

}

--playersIn; // decrement player counter, so pulse knows when to stop

}



// Performance by the Pulse player

fun void doPulse()

{

do {

repeatPhrase(pulsePhrase, 1,0);

} while (playersIn > 0);

// Do a few more pulses to end the piece

repeatPhrase(pulsePhrase, 8,0);

0 => pulseIsPlaying; // Notification that we have stopped

}



// Performance by all non-pulse players

fun void doRileyParts()

{

for (1 => int p; p < players.cap(); ++p)

spork ~ doRileyPart(p);

}



for (0 => int i; i < players.cap(); ++i)

{

players[i] => dac;

0 => players[i].gain;

}



// Start the Pulse

spork ~ doPulse();



// Let him go for a bit...

(phraseLength(pulsePhrase)*4/bps)::second => now;



// Start up all the players

doRileyParts();



// Let time elapse until the pulse stops

do {

1::second => now;

} while (pulseIsPlaying);









rileyEnsemble.ck Description:

Download Filename: rileyEnsemble.ck Filesize: 9.7 KB Downloaded: 964 Time(s)

_________________

<a href="http://www.krazydad.com/">krazydad.com</a>

Last edited by jbum on Sun Nov 05, 2006 2:02 pm; edited 4 times in total

ge







Joined: Aug 13, 2006

Posts: 105

Location: Palo Alto, CA Joined: Aug 13, 2006Posts: 105Location: Palo Alto, CA

Posted: Sat Nov 04, 2006 2:39 am Post subject: Re: 'In C' by Terry Riley

Subject description: A ChucK implementation using randomly repeated phrases This is wonderful. One suggestion for faster download and run: if you want, include the chuck source as an attachment. .ck files should be recognized by the server.



Rock on.

cebec







Joined: Apr 19, 2004

Posts: 1085

Location: Virginia

Audio files:

G2 patch files: Joined: Apr 19, 2004Posts: 1085Location: VirginiaAudio files: 3 G2 patch files: 31

Posted: Sun Nov 05, 2006 1:44 pm Post subject:



['In C' by Terry Riley]:line(448).char(2 : parse error I receive the error:['In C' by Terry Riley]:line(448).char(2: parse error

Last edited by cebec on Sun Nov 05, 2006 2:52 pm; edited 1 time in total

jbum







Joined: Oct 24, 2006

Posts: 26

Location: Los Angeles Joined: Oct 24, 2006Posts: 26Location: Los Angeles

Posted: Sun Nov 05, 2006 2:02 pm Post subject: Try it again - I forgot to turn off HTML parsing the last time I posted an update... (or download the attached version).

_________________

<a href="http://www.krazydad.com/">krazydad.com</a>

cebec







Joined: Apr 19, 2004

Posts: 1085

Location: Virginia

Audio files:

G2 patch files: Joined: Apr 19, 2004Posts: 1085Location: VirginiaAudio files: 3 G2 patch files: 31

Posted: Sun Nov 05, 2006 4:45 pm Post subject: Yeah, that was terrific! It's striking how Balinese it sounds.

Seruka







Joined: Jan 30, 2007

Posts: 1

Location: London Joined: Jan 30, 2007Posts: 1Location: London

Posted: Tue Jan 30, 2007 7:52 pm Post subject: tres bien

Subject description: in c Thats brilliant! Much enjoyed, although way beyond me, it doesnt actually look that daunting, I thought an in c performance in Chuck would look much more brutal, inspiring.

chuckles







Joined: Apr 02, 2007

Posts: 72

Location: San Diego, California Joined: Apr 02, 2007Posts: 72Location: San Diego, California

Posted: Mon May 21, 2007 9:35 am Post subject: Thanks Jbaum



Thanks a lot for posting this, it was a great pedagogical experience (and sort of fun to listen to as well!)



c.



I took your version of In C and went through it to try to understand it. I append my slightly modified version (mainly; I distributed the players across the stereo field using an array of Pan2's).Thanks a lot for posting this, it was a great pedagogical experience (and sort of fun to listen to as well!)c. In_C_137.ck Description: J. Baumgartner's ChucK version of "In C" with a few minor changes: for instance: distributed players across the stereo field using Pan2's, fixed what looked like a minor bug where the last player didn't finish, added comments, reformatted the ph

Download Filename: In_C_137.ck Filesize: 13.11 KB Downloaded: 672 Time(s)

chuckles







Joined: Apr 02, 2007

Posts: 72

Location: San Diego, California Joined: Apr 02, 2007Posts: 72Location: San Diego, California

Posted: Tue Jun 05, 2007 10:49 am Post subject: In C split into two files...



So to run it you simply chuck the In_C_phrases_01.ck file first, then the In_C_commands_01.ck file.



The number of lines seemed to be conserved; in my last version it was about 450 lines total with comments, now we have two files, one 200 and the other 240 lines long.



c.



Partly for my own edification, and partly to make it easier to follow: I created a separate file with the note and phrase data for the In C program in a public class. The commands and procedures are in the second file. This makes it a little more wieldy; you can follow the code flow without having to scroll over a couple hundred lines of data. (This also incidentally mimics the CSound paradigm where the "orchestra" and "score" code are separate entities...even if in the CSD format they can coexist in a single file.)So to run it you simply chuck the In_C_phrases_01.ck file first, then the In_C_commands_01.ck file.The number of lines seemed to be conserved; in my last version it was about 450 lines total with comments, now we have two files, one 200 and the other 240 lines long.c. In_C_phrases_01.ck Description: In_C note and phrase data

Download Filename: In_C_phrases_01.ck Filesize: 6.83 KB Downloaded: 906 Time(s) In_C_commands_01.ck Description: Procedures and code to execute the In C algorithm; ChucK this after the file In_C_phrases_01.ck

Download Filename: In_C_commands_01.ck Filesize: 6.39 KB Downloaded: 525 Time(s)

robhamilton







Joined: Jan 12, 2008

Posts: 8

Location: Stanford, CA Joined: Jan 12, 2008Posts: 8Location: Stanford, CA

Posted: Mon Oct 06, 2008 5:26 pm Post subject: iNc for Laptop Orchestra

Subject description: using Maui and tunable osc clock



To keep the thread going, here's a link to the version of "In C" I wrote for the Stanford Laptop Orchestra last year which we used in a network concert with performers in Beijing (+ stanford performers, 20 laptops and a bunch of acoustic instruments)



"iNc: a realization of Terry Riley's In C for lOrchestra



iNc was realized in the ChucK language for the April 29, 2008 performance of In C at Stanford University's Dinkelspeil Auditorium for the premiere performance of the Stanford Laptop Orchestra, performing alongisde the Stanford New Ensemble, Chris Chafe (celetto), and musicians in Beijing across the internet at the University of Beijing (Beida). The concert was part of the 2008 Stanford Pan Asian Music Festival."



http://ccrma.stanford.edu/~rob/inc/inC-maui.ck

http://ccrma.stanford.edu/~rob/inc/server-MAUI.ck

http://ccrma.stanford.edu/~rob/inc/instructions.pdf

http://ccrma.stanford.edu/~rob/





enjoy,



rob Hah, wish I had seen this thread last year.To keep the thread going, here's a link to the version of "In C" I wrote for the Stanford Laptop Orchestra last year which we used in a network concert with performers in Beijing (+ stanford performers, 20 laptops and a bunch of acoustic instruments)"iNc: a realization of Terry Riley's In C for lOrchestraiNc was realized in the ChucK language for the April 29, 2008 performance of In C at Stanford University's Dinkelspeil Auditorium for the premiere performance of the Stanford Laptop Orchestra, performing alongisde the Stanford New Ensemble, Chris Chafe (celetto), and musicians in Beijing across the internet at the University of Beijing (Beida). The concert was part of the 2008 Stanford Pan Asian Music Festival."enjoy,rob

x_x







Joined: May 05, 2008

Posts: 215

Location: mother earth

Audio files: Joined: May 05, 2008Posts: 215Location: mother earthAudio files: 4

Posted: Mon Jan 26, 2009 12:43 pm Post subject: very cool.



This is a very difficult piece, the sheet music looks so simple but it's actually very difficult to play it correctly as an ensemble.

telstarmagikistferrari







Joined: Jun 16, 2008

Posts: 275

Location: Indianapolis, Indiana

Audio files: Joined: Jun 16, 2008Posts: 275Location: Indianapolis, IndianaAudio files: 43

Posted: Mon Jan 26, 2009 4:11 pm Post subject:



this is a really interesting application of chucK.



all the 'real' musicians' worst dreams have come true! computers performing music! really nice.. I had enjoyed this before, nice to d/l and listen again.this is a really interesting application of chucK.all the 'real' musicians' worst dreams have come true! computers performing music!

jbum







Joined: Oct 24, 2006

Posts: 26

Location: Los Angeles Joined: Oct 24, 2006Posts: 26Location: Los Angeles

Posted: Sat Apr 04, 2009 7:49 am Post subject: "In C" follow up An update on my "In C" project. The ChucK code I originally posted was actually a port of a Python version I made, which produced a MIDI file, some years back.



Recently, I've become very interested in antique mechanical music instruments, and have contacted a number of instrument owners who have installed MIDI controller setups on their pianolas, orchastrelles and orchestreons. I am preparing a version of "In C" which will be played on a single Orchestreon, which has piano, about 10 ranks of organ pipes, xylophone, marimba and percussion. If I manage it video tape it, I'll put it on YouTube and post it here :)



Contact me at jbum "at" jbum "dot" com for more info - I'm not too active here these days.

_________________

<a href="http://www.krazydad.com/">krazydad.com</a>