Ok, I've been rubbish the past few days, had a ton of work on that took all my brainspace.
So, now I've slowly started going. It's been a few months since I looked at Processing, started back into it today but found it difficult. However, I have done some good Max/MSP work on new piece (that's been on my mind all day). Managed to get a basic sample-grabber up and running, and a pitch-changer.
The idea is to have a midi keyboard "playing" a live musician by constantly sampling them and spawning off copies of that at slightly different pitches. In hindsight, it might be easier to build a delay/pitchshifter for this job, but sampling was the first patch I tried.
code/screenshots below, apologies for slightly messy code.
Keyboard sampleSpeed controller:
{
"boxes" : [
{
"box" :
{
"maxclass" : "comment",
"text" : "middle C is normal speed playback, try higher and lower keys",
"linecount" : 3,
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-38",
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 66.0, 14.0, 150.0, 48.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "* -1",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-35",
"outlettype" : [ "int" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 233.0, 97.0, 32.5, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "loadmess 2000",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-33",
"outlettype" : [ "" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 121.0, 178.0, 92.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "+ 1.",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-32",
"outlettype" : [ "float" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 238.0, 149.0, 32.5, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "/ 100.",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-31",
"outlettype" : [ "float" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 235.0, 125.0, 41.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "button",
"numoutlets" : 1,
"id" : "obj-29",
"outlettype" : [ "bang" ],
"fgcolor" : [ 0.152941, 0.956863, 0.152941, 1.0 ],
"numinlets" : 1,
"patching_rect" : [ 36.0, 329.0, 31.0, 31.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "line~",
"numoutlets" : 2,
"fontsize" : 11.595187,
"id" : "obj-24",
"outlettype" : [ "signal", "bang" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 214.5, 437.0, 35.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "play~ test",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-26",
"outlettype" : [ "signal" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 213.0, 463.0, 62.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "t b f",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-23",
"outlettype" : [ "bang", "float" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 236.0, 200.0, 32.5, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "message",
"text" : "0, 2000 2000",
"numoutlets" : 1,
"fontsize" : 11.595187,
"id" : "obj-20",
"outlettype" : [ "" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 219.0, 416.333313, 78.0, 18.0 ]
}
}
,
{
"box" :
{
"maxclass" : "gswitch",
"numoutlets" : 1,
"int" : 1,
"id" : "obj-17",
"outlettype" : [ "" ],
"numinlets" : 3,
"patching_rect" : [ 64.0, 410.0, 41.0, 32.0 ]
}
}
,
{
"box" :
{
"maxclass" : "flonum",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-15",
"outlettype" : [ "float", "bang" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 238.0, 175.0, 50.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "* 1.",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-11",
"outlettype" : [ "float" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 231.0, 224.0, 32.5, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "number",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-10",
"outlettype" : [ "int", "bang" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 171.0, 203.0, 50.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "t b i",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-40",
"outlettype" : [ "bang", "int" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 212.0, 287.0, 32.5, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "t b i",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-39",
"outlettype" : [ "bang", "int" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 167.0, 287.0, 32.5, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "number",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-36",
"outlettype" : [ "int", "bang" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 240.0, 256.0, 50.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "number",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-34",
"outlettype" : [ "int", "bang" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 182.0, 255.0, 50.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "number",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-30",
"outlettype" : [ "int", "bang" ],
"minimum" : 0,
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 121.0, 254.0, 50.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "sprintf %ld\\, %ld %ld",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-28",
"outlettype" : [ "" ],
"fontname" : "Arial",
"numinlets" : 3,
"patching_rect" : [ 117.0, 317.0, 120.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "toggle",
"numoutlets" : 1,
"id" : "obj-25",
"outlettype" : [ "int" ],
"numinlets" : 1,
"patching_rect" : [ 41.0, 462.0, 20.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "message",
"text" : "0, 2000 2000",
"numoutlets" : 1,
"fontsize" : 11.595187,
"id" : "obj-18",
"outlettype" : [ "" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 116.0, 406.333313, 78.0, 18.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "line~",
"numoutlets" : 2,
"fontsize" : 11.595187,
"id" : "obj-19",
"outlettype" : [ "signal", "bang" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 112.5, 428.0, 35.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "*~ 0.7",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-16",
"outlettype" : [ "signal" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 114.0, 481.0, 42.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "dac~",
"numoutlets" : 0,
"fontsize" : 12.0,
"id" : "obj-14",
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 114.0, 524.0, 37.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "play~ test",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-13",
"outlettype" : [ "signal" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 111.0, 454.0, 62.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "message",
"text" : "read",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-8",
"outlettype" : [ "" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 351.0, 91.0, 35.0, 18.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "buffer~ test 2000",
"numoutlets" : 2,
"fontsize" : 12.0,
"id" : "obj-6",
"outlettype" : [ "float", "bang" ],
"fontname" : "Arial",
"numinlets" : 1,
"patching_rect" : [ 345.0, 124.0, 101.0, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "newobj",
"text" : "- 48",
"numoutlets" : 1,
"fontsize" : 12.0,
"id" : "obj-4",
"outlettype" : [ "int" ],
"fontname" : "Arial",
"numinlets" : 2,
"patching_rect" : [ 225.0, 72.0, 32.5, 20.0 ]
}
}
,
{
"box" :
{
"maxclass" : "kslider",
"numoutlets" : 2,
"id" : "obj-1",
"outlettype" : [ "int", "int" ],
"presentation_rect" : [ 0.0, 0.0, 168.0, 53.0 ],
"numinlets" : 2,
"range" : 24,
"patching_rect" : [ 224.0, 9.0, 168.0, 53.0 ]
}
}
],
"lines" : [
{
"patchline" :
{
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-8", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-25", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-13", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-40", 0 ],
"destination" : [ "obj-28", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-40", 1 ],
"destination" : [ "obj-28", 2 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-36", 0 ],
"destination" : [ "obj-40", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-39", 0 ],
"destination" : [ "obj-28", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-39", 1 ],
"destination" : [ "obj-28", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-34", 0 ],
"destination" : [ "obj-39", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-30", 0 ],
"destination" : [ "obj-28", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-28", 0 ],
"destination" : [ "obj-18", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-36", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-34", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-14", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-23", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-23", 1 ],
"destination" : [ "obj-11", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-23", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-24", 0 ],
"destination" : [ "obj-26", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-26", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-20", 0 ],
"destination" : [ "obj-24", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-29", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-29", 0 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-24", 1 ],
"destination" : [ "obj-17", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-32", 0 ],
"destination" : [ "obj-15", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-29", 0 ],
"hidden" : 0,
"midpoints" : [ 73.5, 451.0, 35.5, 451.0, 35.5, 319.0, 45.5, 319.0 ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-31", 0 ],
"destination" : [ "obj-32", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-33", 0 ],
"destination" : [ "obj-10", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-35", 0 ],
"destination" : [ "obj-31", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
,
{
"patchline" :
{
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-35", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}