21 changed files with 165 additions and 30 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,44 @@ |
|||
{ |
|||
"patterns": [ |
|||
{ |
|||
"name": "Pattern 1", |
|||
"numSounds": 5, |
|||
"divider": 8, |
|||
"bank": 1, |
|||
"bpm": 280, |
|||
"pattern": [ |
|||
[true, false, true, false, true, false, true, false], |
|||
[true, false, false, true, false, true, false, false], |
|||
[false, true, false, false, false, false, false, false], |
|||
[false, false, true, false, false, false, true, false], |
|||
[false, false, false, false, true, false, false, false] |
|||
] |
|||
}, |
|||
{ |
|||
"name": "Pattern 2", |
|||
"numSounds": 3, |
|||
"divider": 6, |
|||
"bank": 2, |
|||
"bpm": 180, |
|||
"pattern": [ |
|||
[false, true, false, true, false, true], |
|||
[false, false, true, false, false, true], |
|||
[false, false, false, true, false, false] |
|||
] |
|||
} |
|||
], |
|||
|
|||
"banks": [ |
|||
{"name": "Bank1"}, |
|||
{"name": "Drum"}, |
|||
{"name": "Electric"}, |
|||
{"name": "Bank 123"} |
|||
], |
|||
|
|||
"bpm": [ |
|||
{"value": 80}, |
|||
{"value": 120}, |
|||
{"value": 180}, |
|||
{"value": 280} |
|||
] |
|||
} |
@ -0,0 +1,65 @@ |
|||
String[] patternLabels = {}; |
|||
String[] banksLabels = {}; |
|||
int[] soundNumbersArray = {}; |
|||
int[] dividersArray = {}; |
|||
int[] banksArray = {}; |
|||
int[] bpmPatArray = {}; |
|||
int[] bpmsArray = {}; |
|||
boolean[][][] patternsArray = {}; |
|||
|
|||
void loadData() { |
|||
|
|||
JSONObject json; |
|||
json = loadJSONObject("data.json"); |
|||
|
|||
JSONArray pattsArray = json.getJSONArray("patterns"); |
|||
JSONArray bnksArray = json.getJSONArray("banks"); |
|||
JSONArray bpmArray = json.getJSONArray("bpm"); |
|||
|
|||
for(int bpm=0; bpm<bpmArray.size(); bpm++) { |
|||
JSONObject single = bpmArray.getJSONObject(bpm); |
|||
bpmsArray = append(bpmsArray, single.getInt("value")); |
|||
} |
|||
|
|||
bpm = bpmsArray[0]; |
|||
|
|||
for(int bnk=0; bnk<bnksArray.size(); bnk++) { |
|||
JSONObject single = bnksArray.getJSONObject(bnk); |
|||
banksLabels = append(banksLabels, single.getString("name")); |
|||
} |
|||
|
|||
for(int pat=0; pat<pattsArray.size(); pat++) { |
|||
JSONObject single = pattsArray.getJSONObject(pat); |
|||
JSONArray singlePattsArray = single.getJSONArray("pattern"); |
|||
boolean[][] tmpPat = {}; |
|||
|
|||
patternLabels = append(patternLabels, single.getString("name")); |
|||
soundNumbersArray = append(soundNumbersArray, single.getInt("numSounds")); |
|||
dividersArray = append(dividersArray, single.getInt("divider")); |
|||
banksArray = append(banksArray, single.getInt("bank")); |
|||
bpmPatArray = append(bpmPatArray, single.getInt("bpm")); |
|||
|
|||
for(int x=0; x<singlePattsArray.size(); x++) { |
|||
boolean[] tmpRow = {}; |
|||
JSONArray rowsArray = singlePattsArray.getJSONArray(x); |
|||
for(int y=0; y<rowsArray.size(); y++) { |
|||
boolean boolVal = rowsArray.getBoolean(y); |
|||
tmpRow = (boolean[]) append(tmpRow, boolVal); |
|||
} |
|||
tmpPat = (boolean[][]) append(tmpPat, tmpRow); |
|||
} |
|||
patternsArray = (boolean[][][]) append(patternsArray, tmpPat); |
|||
} |
|||
|
|||
/* |
|||
for(int i=0; i<patternsArray.length; i++) { |
|||
println("######"+i); |
|||
for(int x=0; x<patternsArray[i].length; x++) { |
|||
println("######"+x); |
|||
printArray(patternsArray[i][x]); |
|||
} |
|||
} |
|||
*/ |
|||
|
|||
|
|||
} |
@ -1,33 +1,27 @@ |
|||
void setData() { |
|||
|
|||
numSounds = 5; |
|||
numTracks = numSounds; |
|||
bpm = 280; |
|||
pattern = 1; |
|||
|
|||
swing = 50; |
|||
divider = 16; |
|||
duration = int((60/float(bpm))*1000); |
|||
beat = 0; |
|||
|
|||
//println(bpm); |
|||
//println(patternLabel); |
|||
|
|||
String bank = controller[2]; |
|||
|
|||
println(bank); |
|||
println(patternLabel); |
|||
|
|||
/* |
|||
samples = new boolean[numTracks][divider]; |
|||
for(int i=0; i<numTracks; i++) { |
|||
boolean[] tmp = new boolean[divider]; |
|||
for(int x=0; x<divider; x++) { |
|||
tmp[x] = false; |
|||
} |
|||
|
|||
samples[i] = tmp; |
|||
} |
|||
samples[i] = tmp; |
|||
}*/ |
|||
|
|||
// Load sound files |
|||
file = new SoundFile[numSounds]; |
|||
for (int i = 0; i < numSounds; i++) { |
|||
file[i] = new SoundFile(this, bank + "/" + (i+1) + ".wav"); |
|||
file[i] = new SoundFile(this, "BANK" + bank + "/" + (i+1) + ".wav"); |
|||
} |
|||
|
|||
} |
|||
|
Loading…
Reference in new issue