diff --git a/Processing/Sampler/Sampler.pde b/Processing/Sampler/Sampler.pde index 4728b46..7683b29 100644 --- a/Processing/Sampler/Sampler.pde +++ b/Processing/Sampler/Sampler.pde @@ -7,37 +7,41 @@ int numSounds = 0; int numTracks = 0; int bpm = 0; int pattern = 0; +int bank = 0; int swing = 0; int divider = 0; int duration = 0; int beat = 0; String patternLabel = "NO PATTERN"; +String bpmLabel = "UNSET"; String swingLabel = "100%"; boolean[][] samples; void setup() { - size(640, 460); + size(640, 460, P2D); background(255); + loadData(); setData(); } void draw() { background(50); - stroke(255); + strokeWeight(3); fill(200); printControllerStatus(); - if(controller[0] == "PLAY") { - for(int i=0; i= 64 && keyCode <= 88) { // From A to Z @@ -28,6 +30,10 @@ void keyPressed() { controller[1] = controller[1] == "UNSET" ? "REC/OVERDUB" : "UNSET"; doRec = true; } + if(key == 's') { // BPM + bpmLabel = "CHOOSE..."; + chooseBPM = true; + } if(key == 'o') { // PATTERN choosePattern = true; controller[0] = "STOP"; @@ -42,17 +48,36 @@ void keyPressed() { ereaseRow = controller[1] == "EREASE" ? keyCode-48 : 0; doErease = ereaseRow>0; - if(code >= 0 && code < numSounds && !doErease) { + //&& code < numSounds + if(code >= 0 && !doErease) { + if(chooseBank) { - controller[2] = "BANK" + (code+1); - setData(); + controller[2] = banksLabels[code]; + bank = code+1; chooseBank = false; + setData(); + + } else if(chooseBPM) { + bpmLabel = bpmsArray[code]+""; + bpm = bpmsArray[code]; + chooseBPM = false; + setData(); + } else if(choosePattern) { - pattern = (code+1); + pattern = code; patternLabel = "PATTERN" + (code+1); - setData(); choosePattern = false; - } else if(controller[1] != "EREASE" && controller[1] != "UNSET") { + samples = patternsArray[code]; + numSounds = soundNumbersArray[code]; + divider = dividersArray[code]; + bank = banksArray[code]; + bpm = bpmPatArray[code]; + bpmLabel = bpmPatArray[code]+""; + numTracks = numSounds; + controller[2] = banksLabels[code]; + setData(); + + } else if(controller[1] != "EREASE" && controller[1] != "UNSET" && controller[0] != "STOP") { setBeat(beat, code); } } diff --git a/Processing/Sampler/controllerStatus.pde b/Processing/Sampler/controllerStatus.pde index e0a73d1..5108958 100644 --- a/Processing/Sampler/controllerStatus.pde +++ b/Processing/Sampler/controllerStatus.pde @@ -20,9 +20,10 @@ void printControllerStatus() { fill(240); text(patternLabel, (width/2)+100, height-75); - text(bpm, (width/2)+100, height-55); + text(bpmLabel, (width/2)+100, height-55); text(swing, (width/2)+100, height-35); stroke(200); line(width/2, height-85, width/2, height-15); + } diff --git a/Processing/Sampler/data/1.aif b/Processing/Sampler/data/1.aif deleted file mode 100644 index fd65b31..0000000 Binary files a/Processing/Sampler/data/1.aif and /dev/null differ diff --git a/Processing/Sampler/data/2.aif b/Processing/Sampler/data/2.aif deleted file mode 100644 index 742301e..0000000 Binary files a/Processing/Sampler/data/2.aif and /dev/null differ diff --git a/Processing/Sampler/data/3.aif b/Processing/Sampler/data/3.aif deleted file mode 100644 index 7b8da50..0000000 Binary files a/Processing/Sampler/data/3.aif and /dev/null differ diff --git a/Processing/Sampler/data/4.aif b/Processing/Sampler/data/4.aif deleted file mode 100644 index 7884a34..0000000 Binary files a/Processing/Sampler/data/4.aif and /dev/null differ diff --git a/Processing/Sampler/data/5.aif b/Processing/Sampler/data/5.aif deleted file mode 100644 index 5664dad..0000000 Binary files a/Processing/Sampler/data/5.aif and /dev/null differ diff --git a/Processing/Sampler/data/BANK3/1.wav b/Processing/Sampler/data/BANK3/1.wav new file mode 100644 index 0000000..35c8175 Binary files /dev/null and b/Processing/Sampler/data/BANK3/1.wav differ diff --git a/Processing/Sampler/data/BANK3/2.wav b/Processing/Sampler/data/BANK3/2.wav new file mode 100644 index 0000000..32bd834 Binary files /dev/null and b/Processing/Sampler/data/BANK3/2.wav differ diff --git a/Processing/Sampler/data/BANK3/3.wav b/Processing/Sampler/data/BANK3/3.wav new file mode 100644 index 0000000..101c110 Binary files /dev/null and b/Processing/Sampler/data/BANK3/3.wav differ diff --git a/Processing/Sampler/data/BANK3/4.wav b/Processing/Sampler/data/BANK3/4.wav new file mode 100644 index 0000000..f997096 Binary files /dev/null and b/Processing/Sampler/data/BANK3/4.wav differ diff --git a/Processing/Sampler/data/BANK3/5.wav b/Processing/Sampler/data/BANK3/5.wav new file mode 100644 index 0000000..6641aed Binary files /dev/null and b/Processing/Sampler/data/BANK3/5.wav differ diff --git a/Processing/Sampler/data/BANK4/1.wav b/Processing/Sampler/data/BANK4/1.wav new file mode 100644 index 0000000..35c8175 Binary files /dev/null and b/Processing/Sampler/data/BANK4/1.wav differ diff --git a/Processing/Sampler/data/BANK4/2.wav b/Processing/Sampler/data/BANK4/2.wav new file mode 100644 index 0000000..32bd834 Binary files /dev/null and b/Processing/Sampler/data/BANK4/2.wav differ diff --git a/Processing/Sampler/data/BANK4/3.wav b/Processing/Sampler/data/BANK4/3.wav new file mode 100644 index 0000000..101c110 Binary files /dev/null and b/Processing/Sampler/data/BANK4/3.wav differ diff --git a/Processing/Sampler/data/BANK4/4.wav b/Processing/Sampler/data/BANK4/4.wav new file mode 100644 index 0000000..f997096 Binary files /dev/null and b/Processing/Sampler/data/BANK4/4.wav differ diff --git a/Processing/Sampler/data/BANK4/5.wav b/Processing/Sampler/data/BANK4/5.wav new file mode 100644 index 0000000..6641aed Binary files /dev/null and b/Processing/Sampler/data/BANK4/5.wav differ diff --git a/Processing/Sampler/data/data.json b/Processing/Sampler/data/data.json new file mode 100644 index 0000000..e20803f --- /dev/null +++ b/Processing/Sampler/data/data.json @@ -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} + ] +} diff --git a/Processing/Sampler/loadData.pde b/Processing/Sampler/loadData.pde new file mode 100644 index 0000000..41dc4e1 --- /dev/null +++ b/Processing/Sampler/loadData.pde @@ -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