-
-
Save adubspea/3c6b95d795be154703bc to your computer and use it in GitHub Desktop.
import arb.soundcipher.*; | |
SoundCipher sc = new SoundCipher(this); | |
for (int n = 7 ; n < 50; n += 7) { // N = average North wind direction | |
if (n < 5) { | |
sc.playNote(80, 60, 50); | |
} else if (n < 2) { | |
float[] pitches = {100, 64, 67, 71}; | |
sc.playChord(pitches, 80, 4); | |
} else if (n > 2) { | |
sc.repeat(3); | |
sc.playNote (70, 40, 10); | |
float[] pitches = {50, 50, 50, 50}; | |
sc.playChord(pitches, 80, 4); | |
} | |
} |
Here's another example:
import arb.soundcipher.*;
SoundCipher sc = new SoundCipher(this);
for (int n = 7 ; n < 50; n += 7) { // N = average North wind direction for August 1 - 16
if (n >= 7){
float[] pitches = {50};
float [] dynamics = {50};
float[] durations = {15};
sc.playPhrase(pitches, dynamics, durations);
} else if (n > 0) {
sc.repeat(3);
sc.playNote (70, 40, 10);
float[] pitches = {50, 50, 50, 50};
sc.playChord(pitches, 80, 4);
}
}
I'd have to be more familiar with SoundCipher. In general though: your statement doesn't have to be else if
, it can just be if this then that
many times over. Example:
a = 1
b = 2
if a is 1
print 'a is 1'
if b is 2
print 'b is 2'
That's pseudocode, but it should print
a is 1
b is 2
Know what I mean?
Nope, I don't know what you mean!
Can you give me another example?
for (int n = 7 ; n < 50; n += 7)
} if (s < 20) { //trying to get the program to play multiple notes by using if instead of if & else
float[] pitches = {60, 20, 30, 25};
float [] dynamics = {60, 60, 60, 60};
float[] durations = {5, 5, 5, 5};
sc.playPhrase(pitches, dynamics, durations);
if (n > 2){
float[] pitches = {50, 40, 30, 25};
float [] dynamics = {80, 80, 80, 80};
float[] durations = {5, 5, 5, 5};
sc.playPhrase(pitches, dynamics, durations);
Cool! I’ll take a look later today and see if I can figure it out.