Skip to content

Instantly share code, notes, and snippets.

@adubspea
Created August 21, 2015 19:55
Show Gist options
  • Save adubspea/f47daa59ffc4f4eef081 to your computer and use it in GitHub Desktop.
Save adubspea/f47daa59ffc4f4eef081 to your computer and use it in GitHub Desktop.
import arb.soundcipher.*;
SoundCipher sc = new SoundCipher(this);
SCScore score = new SCScore();
score.VIBRAPHONE;
//The constants are implemented by both the SoundCipher and SCScore classes so they can be accessed using 'dot' notation from instances of any of these classes, for example;
//after: SoundCipher sc = new SoundCipher(this);
//access contants using: sc.FLUTE
//after: SCSCore score = new SCScore();
//access constants using: score.FLUTE
//but everytime I try to add an instrument i get an error that says "VariableDeclarators"
float[] pitches = {7, 4, 9, 9};
float chordPitches[] = new float [5];
float[] bassPitches = new float[4];
float[] bassDynamics = new float[4];
float[] bassDurations = new float[4];
float[] bassArticulations = new float[4];
float[] bassPans = new float[4];
int n = 2;
int nne = 1;
int ne = 2;
int ene = 2;
int e = 3;
int ese = 3;
int se = 3;
int sse = 4;
int s = 10;
int ssw = 14;
int sw = 6;
int wsw = 10;
int w = 15;
int wnw = 12;
int nw = 10;
int nnw = 6;
if (n > 1)
score.addNote(8, 9, 0, 36, 100, 1, 1, 80);
if (nne > 0)
for (int i=0; i<5; i++)
chordPitches[i] = 60 + pitches[(int)(random(pitches.length))];
if (ne > 1)
score.addChord(0.5,0,0,chordPitches,30,2,0.8,64);
if (ene > 1)
score.addChord(4,0,0,chordPitches,30,2,0.8,64);
if (e > 2)
score.addChord(2,0,2,chordPitches,30,2,0.8,64);
if (ese < 3)
score.addChord(1,1,0,chordPitches,30,2,2,64);
if (se < 4)
score.addChord(4,2,1,chordPitches,30,2,0.5,64);
for (int i=0; i<4; i++) {
if (i<1) {
bassDurations[i] = 1;
bassPitches[i] = 36;
} else {
bassDurations[i] = random(1) * 0.8 + 0.8;
bassPitches[i] = 20 + pitches[(int)(random(pitches.length))];
}
bassDynamics[i] = random(10) + 40;
bassArticulations[i] = 0.8;
bassPans[i] = 64;
}
score.addPhrase(2, 0, 34, bassPitches, bassDynamics, bassDurations, bassArticulations, bassPans);
if (sse > 3)
score.addPhrase(2, 0, 34,bassPitches,bassDynamics,bassDurations,bassArticulations,bassPans);
if (s > 5)
score.addNote(2, 9, 0, 36, 100, 1, 2, 80);
score.play(2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment