ChucK Program Scales

From CSWiki
Jump to: navigation, search
// scales.ck

// (we need arrays now!) 

// author: Mikael Johansson (mikael/at/johansson.org)

55.000=>float A0;
110.000=>float A1; 
220.000=>float A2; 
440.000=>float A3; 
880.000=> float A4;
1760.000=>float A5;

58.270 =>float Bb0; 
116.541 =>float Bb1;
233.082 =>float Bb2;
466.164 =>float Bb3;
932.328 =>float Bb4;
1864.655=>float Bb5;

61.735  =>float B0;
123.471=> float B1;
246.942=> float B2;
493.883=> float B3;
987.767=> float B4;
1975.533=>float B5;

65.406 =>float C0;  
130.813 =>float C1; 
261.626 =>float C2; 
523.251 =>float C3; 
1046.502 =>float C4;
2093.005=>float C5;

69.296 =>float Db0;  
138.591 =>float Db1; 
277.183 =>float Db2; 
554.365 =>float Db3; 
1108.731 =>float Db4;
2217.461=> float Db5;

73.416 =>float D0; 
146.832 =>float D1;
293.665 =>float D2;
587.330 =>float D3; 
1174.659 =>float D4;
2349.318=> float D5;

77.782 =>float Eb0; 
155.563 =>float Eb1;
311.127 =>float Eb2;
622.254 =>float Eb3; 
1244.508 =>float Eb4;
2489.016=>float Eb5;

82.407 =>float E0;   
164.814 =>float E1;  
329.628 =>float E2;  
659.255 =>float E3;  
1318.510 =>float E4; 
2637.020=>float E5;

87.307 =>float F0; 
174.614 =>float F1;
349.228 =>float F2; 
698.456 =>float F3; 
1396.913 =>float F4;
2793.826=>float F5;

92.499 =>float Gb0; 
184.997 =>float Gb1;
369.994 =>float Gb2; 
739.989 =>float Gb3; 
1479.978 =>float Gb4;
2959.955=>float Gb5;

97.999 =>float G0;
195.998 =>float G1;
391.995 =>float G2;  
783.991 =>float G3;  
1567.982 =>float G4;
3135.963=>float G5;

103.826 =>float Ab0;
207.652 =>float Ab1;
415.305 =>float Ab2;
830.609 =>float Ab3;
1661.219 =>float Ab4;
3322.438=>float Ab5;

// Scale references 
//             1  2 3 4  5 6  7 8  9 10 11 12 13
// Chromatic   C Db D Eb E F Gb G Ab A  Bb B  C

// Spanish 8 Tone  C Db Eb E F Gb Ab Bb C
// Flamenco        C Db Eb E F G Ab Bb C
// Symmetrical     C Db Eb E Gb G A Bb C
// Diminished      C D Eb F Gb Ab A B C
// Whole Tone      C D E Gb Ab Bb C
// Augmented       C Eb E G Ab B C
// 3 semitone      C Eb Gb A C
// 4 semitone      C E Ab C
//
// Ultra Locrian   C Db Eb E Gb Ab A C
// Super Locrian   C Db Eb E Gb Ab Bb C                    (Ravel)
// Indian-ish*     C Db Eb E G Ab Bb C
// Locrian         C Db Eb F Gb Ab Bb C
// Phrygian        C Db Eb F G  Ab Bb C
// Neapolitan Min  C Db Eb F G Ab B C
// Javanese        C Db Eb F G A Bb C
// Neapolitan Maj  C Db Eb F G A B C
// Todi (Indian)   C Db Eb Gb G Ab B C
// Persian         C Db E F Gb Ab B C
// Oriental        C Db E F Gb A Bb C
// Maj.Phryg. (Dom)C Db E F G Ab Bb C                      Spanish/ Jewish
// Double Harmonic C Db E F G Ab B C                       Gypsy/ Byzantine/ Ch$
// Marva (Indian)  C Db E Gb G A B C
// Enigmatic       C Db E Gb Ab Bb B C 
// 
// Locrian Natural 2nd  C D Eb F Gb Ab Bb C
// Minor (natural)      C D Eb F G Ab Bb C                 Aeolian/ Algerian (o$
// Harmonic Minor       C D Eb F G Ab B C                  Mohammedan
// Dorian               C D Eb F G A Bb C
// Melodic Minor (Asc)  C D Eb F G A B C                   Hawaiian
// Hungarian Gypsy      C D Eb Gb G Ab Bb C
// Hungarian Minor      C D Eb Gb G Ab B C                 Algerian (oct1)
// Romanian             C D Eb Gb G A Bb C
// 
// Maj. Locrian         C  D  E  F  Gb Ab Bb C  Arabian
// Hindu                C  D  E  F  G  Ab Bb C  -
// Ethiopian            C  D  E  F  G   Ab B  C
// Mixolydian           C  D  E  F  G  A  Bb C  -
// Major                C  D  E  F  G  A  B  C  Ionian
// Mixolydian Aug.      C  D  E  F  Ab A  Bb C  -
// Harmonic Major       C  D  E  F  Ab A  B  C  -
// Lydian Min.          C  D  E  Gb G  Ab Bb C  -
// Lydian Dominant      C  D  E  Gb G  A  Bb C  Overtone
// Lydian               C  D  E  Gb G  A  B  C  -
// Lydian Aug.          C  D  E  Gb Ab A  Bb C  -
// Leading Whole Tone   C  D  E  Gb Ab Bb B  C  -
// Bluesy R&R*          C  Eb E  F  G  A  Bb C  -
// Hungarian Major      C  Eb E  Gb G  A  Bb C  Lydian sharp2nd
// 
// "pB"                 C  Db Eb Gb Ab C  -
// Balinechuck@lists.cs.princeton.eduse 1           C  Db Eb G  Ab C  "pE"
// Pelog (Balinese)     C  Db Eb G  Bb C  -
// Iwato (Japanese)     C  Db F  Gb Bb C  -
// Japanese 1           C  Db F  G  Ab C  Kumoi
// Hirajoshi (Japanese) C  D  Eb G  Ab C  "pA"
// "pD"                 C  D  Eb G  A  C  -
// Pentatonic Major     C  D  E  G  A  C  Chinese 1/ Mongolian/ "pFCG"
// Egyptian             C  D  F  G  Bb C  -
// Pentatonic Minor     C  Eb F  G  Bb C  -
// Chinese 2            C  E  Gb G  B  C  -

75::ms => dur T;

Mandolin s => Echo e => NRev r => dac;

0.2 => r.mix;
2::T => e.delay;
1 => int m;
0 => int tone;
2 => int octave;
5 => int n_tones;
while(true) {
    if(m%2==0) tone+1 => tone;
    if(m%3==0) tone-2 => tone;
    if(m%5==0) tone+3 => tone;
    if(m%7==0) tone-4 => tone;
    if(m%11==0) tone+5 => tone;
    std.rand2(0,3)+tone => tone;
    while(tone<0) { tone+n_tones => tone; octave-1=>octave; }
    while(tone>=n_tones) {tone-n_tones => tone; octave+1 => octave; }

    // Egyptian             C  D  F  G  Bb C  -
    if(tone==0)
      C3 => s.freq;
    if(tone==1)
      D3 => s.freq;
    if(tone==2) 
      E3 => s.freq;
    if(tone==3)
      G3 => s.freq;
    if(tone==4)  
      A3 => s.freq;
    if(tone==5)
      A3 => s.freq;
    if(tone==6)
      Bb3 => s.freq;
    if(tone==7)
      Bb3 => s.freq;
    m+1 => m;
    std.rand2f(0.9,1.0) => s.pluck;
    std.rand2f(0.9,1.0)::T => now;
    std.rand2f(0.6,0.7) => s.pluck;
    std.rand2f(0.9,1.0)::T => now;
    std.rand2f(0.8,0.9) => s.pluck;
    std.rand2f(0.9,1.0)::T => now;
    std.rand2f(0.5,0.6) => s.pluck;
    std.rand2f(0.9,1.0)::T => now;
}