Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Last active June 16, 2017 22:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jamesmichiemo/7308629 to your computer and use it in GitHub Desktop.
Save jamesmichiemo/7308629 to your computer and use it in GitHub Desktop.
the melody sequence for Final Fantasy III's Prelude Theme written in the ChucK programming language
// James Michiemo 03nov13
TriOsc s => dac;
.7 => s.gain;
// music keys for the Final Fantasy Prelude Theme
// 1, 3
// c d e g g e d
// c d e g g e d c
// c d e g g e d c·
// c d e g g e d c·
// c
// 2,4
// a b c e e c b
// a b c e e c b a
// a b c e e c b a
// a b c e e c b a
// a
// 5
// a c f g g f c·
// a c f g g f c a
// a c f g g f c a
// a c f g g f c a
// a
// 6
// b d g a a g d·
// b d g a a g d b
// b d g a a g d b
// b d g a a g d b
// b
// 7
// ab c eb g g eb c·
// ab c eb g g eb c ab
// ab c eb g g eb c ab
// ab c eb g g eb c ab·
// ab·
// 8
// bb d f a a f d bb
// bb d f a a f d bb
// bb d f a a f d bb
// bb d f a a f d bb·
// bb
// midi sequence
[24,26,28,31,36,38,40,43,48,50,52,55,60,62,64,67,72] @=> int gold[];
[21,23,24,28,33,35,36,40,45,47,48,52,57,59,60,64,69] @=> int mythril[];
[21,24,29,31,33,36,41,43,45,48,53,55,57,60,65,67,69] @=> int platinum[];
[23,26,31,33,35,38,43,45,47,50,55,57,59,62,67,69,71] @=> int diamond[];
[20,24,27,31,32,36,39,43,44,48,51,55,56,60,63,67,68] @=> int adamant[];
[22,26,29,33,34,38,41,45,46,50,53,57,58,62,65,69,70] @=> int wurzite[];
while(true){
0 => int crystalCount;
while(crystalCount < 2){
// loop up
for( 0 => int i; i < gold.cap(); i++){
<<< i, gold[i] >>>; // print index and value
Std.mtof(gold[i]) => s.freq; // midi to freq
.15::second => now; // advance time
}
// loop down
for( (gold.cap()-2) => int j; j >= 0; j--){
<<< j, gold[j] >>>;
Std.mtof(gold[j]) => s.freq;
.15::second => now;
}
// loop up
for( 0 => int i; i < mythril.cap(); i++){
<<< i, mythril[i] >>>;
Std.mtof(mythril[i]) => s.freq;
.15::second => now;
}
// loop down
for( (mythril.cap()-2) => int j; j >= 0; j--){
<<< j, mythril[j] >>>;
Std.mtof(mythril[j]) => s.freq;
.15::second => now;
}
crystalCount++;
····
}
// loop up
for( 0 => int i; i < platinum.cap(); i++){
<<< i, platinum[i] >>>;
Std.mtof(platinum[i]) => s.freq;
.15::second => now;
}
// loop down
for( (platinum.cap()-2) => int j; j >= 0; j--){
<<< j, platinum[j] >>>;
Std.mtof(platinum[j]) => s.freq;
.15::second => now;
}
// loop up
for( 0 => int i; i < diamond.cap(); i++){
<<< i, diamond[i] >>>;
Std.mtof(diamond[i]) => s.freq;
.15::second => now;
// loop down
for( (diamond.cap()-2) => int j; j >= 0; j--){
<<< j, diamond[j] >>>;
Std.mtof(diamond[j]) => s.freq;
.15::second => now;
}
// loop up
for( 0 => int i; i < adamant.cap(); i++){
<<< i, adamant[i] >>>;
Std.mtof(adamant[i]) => s.freq;
.15::second => now;
}
// loop down
for( (adamant.cap()-2) => int j; j >= 0; j--){
<<< j, adamant[j] >>>;
Std.mtof(adamant[j]) => s.freq;
.15::second => now;
}
// loop up
for( 0 => int i; i < wurzite.cap(); i++){
<<< i, wurzite[i] >>>;
Std.mtof(wurzite[i]) => s.freq;
.15::second => now;
}
// loop down
for( (wurzite.cap()-2) => int j; j >= 0; j--){
<<< j, wurzite[j] >>>;
Std.mtof(wurzite[j]) => s.freq;
.15::second => now;
}
0 => crystalCount;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment