Removing spaces from messages
I'm trying to write a patch to automatically generate and write to file LFO waveforms. I'm having trouble figuring out how to automate writing to file, however. I have a counter object that goes through a prepend and an append object before triggering a wavewrite message to the buffer. But becuase of the spaces, the message ends up saying "wavewrite seq 01 .wav", which the buffer doesn't accept. Is there anyway to remove spaces from a string?
You can try the tosymbol object so that max recognize your string as a symbol.
If your string always has the same lenght, you could do it with "sprintf %s%s.wav" for instance.
Both solutions would work I think.
I find that it's easier to generate a proper filename (using [sprintf] and/or [combine]) than it is to fix one that's broken.
An alternative.
Lobjects... is there anything they can't do?
Max... is there anything it can't do?
@AudioMatt: You rock, and so does Max/MSP !
I just came across the same problem; needed to get a word in a list between '()' (can't come up with the English name of the ( right now, duh) and ended up with '( word )'.
I found this thread and your patch; wonderful indeed. Learned something more about Max (when looking back its soo easy ;-)) and took the liberty to use it in order to finish my patch (LOM.Navigator).
Oh; for the record: naturally provided full credits in the patcher object. I never take credit for someone elses work.
Thanks again for sharing; sure saved me lots of time today!
I want to do this but with a list of numbers... I want to make 60 61 62 become 606162
I tried using these patches but the atoi obviously doesnt work with this.
Any suggestions?
Thanks
Lee
??
Thanks for the quick response! This works great, until I enter a list with more than 4 separated numbers.... for example, if I enter 23 43 55 66 54 then this is generated at the output -1951410642 :S No idea whats going on there! lol
So this would be great if I could get it to work up to about 5 or 6 separated numbers.
I have been looking through the forum for hours and theres loads of posts about it, but nothing is quite right for my needs.
I tried using sprintf %i%i%i%i%i but if for example I only have 2 separated numbers like 33 66 , then sprintf adds zeros to the remaining figures 3366000
So then, I found this regexp configuration:
But, like your patch, it only works up to 4 separated numbers, and then if I add a fifth, a bunch of random numbers are generated from the output. I really dont get the regexp arguments/syntax... makes no sense to me
:S
Thanks in advance
Lee
This issue probably has to do with the limits of the integer size in Max. Once it goes over that limit it wraps to negative numbers. Perhaps some more context about what you're trying to accomplish would let people suggest different approaches.
Thanks for the patch, but this still separates the numbers after the 2nd regexp.... on the output for the first regexp it still does the same thing if its all just numbers but it works if you have a word infront of the numbers like in your example! weird :S
Ok, a brief summary of what I'm trying to achieve:
Im working on a generative music patch that can generate simple chords and melody. For melody, it works by analyzing the melody MIDI files into a State Transistion Matrix which is then used as a Markov chain to show which notes proceeded the current selected note and the probability is based on how many times that note is in the list. For example, if the note 'C' is currently selected and it was found the note after each C in the midi file was D, D, E, F, then theres a 50% chance of getting a D, 25% chance of getting an E and 25% chance of getting an F. I found this guys markov chain patch here:
And the patch itself can be found below.
So this works by creating the STM in a coll list, so the happy birthday melody turns out like this inside the coll (referring to MIDI numbers).
77, 72 76 72 77 76 79;
72, 72 74 77 72 74 79 72 84;
74, 72 72 82;
76, 72 74;
79, 77 77;
84, 81;
81, 77 77;
82, 82 81;
This is all fine when it comes to single notes, but the problem I'm having is using the same system for chords.
A chord in max can be represented as a list like 70 73 77 , but If I were to load a midi file (with chords like this) into coll, then it see's them as separate notes and not the chord, and then the STM is just all weird and wrong.
So since theres no way to group separate terms in coll into 'one' term (as far as I know) then I figure I would just add a stage in the MIDI analysis that makes each chord into the list like above (70 73 77) then pass them through something that takes away the spaces so that it becomes one number (707377). Therefore, since this is now just one number, a chord STM can be made inside a coll object. So for example:
606467, 626569 677174;
626569, 657972;
657972, 677174 606467;
677174, 606467 626569;
This says that after each 606467 chord (which is 60 64 67 played together), either a 626569 or 677174, and then on the way back out before it gets to 'iter and makenote', I can simply separate the numbers again into 62 65 69 so that iter and makenote can read them as a chord. Thanks to this forum, the separation part has been taken care of with a regexp expression.
BUT I need to be able to stick them all together before they can made into the coll STM and since a chord can be created with around 5 or 6 separate notes (the maximum I need anyway since I'm not analyzing jazz! lol), I need these ideas that people have been presenting to be able to stick something like 22 33 44 55 66 77 into 223344556677, but they just freak out after I add more than 4 terms.
To be honest, its likely that I wont get more than 5 note chords and if thats the case I can always just remove the unimportant tones like the 5th or something to make it 4 notes, but it will still be nice to have the option.
Also, I could forget about the analysis configuration and build the STM manually, but that would just take ages for each song I analyse and it just defies the point of being a Max user :P
Anyway, hope I've made this clear enough?
I really hope theres a way around this integer limit thing :S
Thanks everyone
Lee
{
"patcher" : {
"fileversion" : 1,
"rect" : [ 203.0, 62.0, 1459.0, 901.0 ],
"bglocked" : 0,
"defrect" : [ 203.0, 62.0, 1459.0, 901.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "del 10",
"outlettype" : [ "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 150.0, 345.0, 43.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-16",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "First Order Markov",
"fontsize" : 12.0,
"patching_rect" : [ 11.0, 21.0, 150.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-79",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Change index note",
"fontsize" : 12.0,
"patching_rect" : [ 151.0, 320.0, 150.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-24",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 221.0, 261.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-22",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s finished",
"fontsize" : 12.0,
"patching_rect" : [ 218.0, 294.0, 61.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-21",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Analysis Section",
"fontsize" : 12.0,
"patching_rect" : [ 22.0, 46.0, 101.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-19",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "comment",
"text" : "Generation Section",
"fontsize" : 12.0,
"patching_rect" : [ 28.0, 240.0, 150.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-17",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "noteout",
"fontsize" : 12.0,
"patching_rect" : [ 34.0, 456.0, 51.0, 20.0 ],
"numinlets" : 3,
"id" : "obj-15",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "makenote 100 500",
"outlettype" : [ "float", "float" ],
"fontsize" : 12.0,
"patching_rect" : [ 34.0, 427.0, 110.0, 20.0 ],
"numinlets" : 3,
"id" : "obj-14",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 34.0, 401.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-13",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p markovPitchGenerate",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 34.0, 373.0, 137.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-12",
"fontname" : "Arial",
"numoutlets" : 1,
"patcher" : {
"fileversion" : 1,
"rect" : [ 1680.0, 272.0, 638.0, 550.0 ],
"bglocked" : 0,
"defrect" : [ 1680.0, 272.0, 638.0, 550.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "mxj list.Length",
"outlettype" : [ "", "" ],
"fontsize" : 12.0,
"patching_rect" : [ 51.0, 243.0, 87.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-20",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 187.0, 463.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-19",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "coll pitchMatrix",
"outlettype" : [ "", "", "", "" ],
"fontsize" : 12.0,
"patching_rect" : [ 187.0, 436.0, 90.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-18",
"fontname" : "Arial",
"numoutlets" : 4,
"saved_object_attributes" : {
"embed" : 0
}
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "nth $2 $1",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 187.0, 411.0, 61.0, 18.0 ],
"numinlets" : 2,
"id" : "obj-17",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "pack",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 187.0, 384.0, 36.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-16",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "+ 1",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 51.0, 330.0, 32.5, 20.0 ],
"numinlets" : 2,
"id" : "obj-15",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "random",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 51.0, 301.0, 51.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-14",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t b i",
"outlettype" : [ "bang", "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 51.0, 271.0, 32.5, 20.0 ],
"numinlets" : 1,
"id" : "obj-13",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 292.0, 111.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-12",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "coll pitchMatrix",
"outlettype" : [ "", "", "", "" ],
"fontsize" : 12.0,
"patching_rect" : [ 292.0, 86.0, 90.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-11",
"fontname" : "Arial",
"numoutlets" : 4,
"saved_object_attributes" : {
"embed" : 0
}
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r finished",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 388.0, 17.0, 59.0, 20.0 ],
"numinlets" : 0,
"id" : "obj-10",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "next",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 292.0, 59.0, 33.0, 18.0 ],
"numinlets" : 2,
"id" : "obj-9",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "coll pitchMatrix",
"outlettype" : [ "", "", "", "" ],
"fontsize" : 12.0,
"patching_rect" : [ 50.0, 216.0, 90.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-7",
"fontname" : "Arial",
"numoutlets" : 4,
"saved_object_attributes" : {
"embed" : 0
}
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t i i",
"outlettype" : [ "int", "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 187.0, 166.0, 33.5, 20.0 ],
"numinlets" : 1,
"id" : "obj-6",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "i",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 187.0, 138.0, 33.5, 20.0 ],
"numinlets" : 2,
"id" : "obj-5",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 187.0, 54.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-4",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "outlet",
"patching_rect" : [ 187.0, 492.0, 25.0, 25.0 ],
"numinlets" : 1,
"id" : "obj-3",
"numoutlets" : 0,
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "inlet",
"outlettype" : [ "bang" ],
"patching_rect" : [ 292.0, 22.0, 25.0, 25.0 ],
"numinlets" : 0,
"id" : "obj-2",
"numoutlets" : 1,
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "inlet",
"outlettype" : [ "bang" ],
"patching_rect" : [ 187.0, 22.0, 25.0, 25.0 ],
"numinlets" : 0,
"id" : "obj-1",
"numoutlets" : 1,
"comment" : ""
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-7", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-10", 0 ],
"destination" : [ "obj-9", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-9", 0 ],
"destination" : [ "obj-11", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-11", 0 ],
"destination" : [ "obj-12", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-12", 0 ],
"destination" : [ "obj-5", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 0 ],
"destination" : [ "obj-14", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-13", 1 ],
"destination" : [ "obj-14", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-14", 0 ],
"destination" : [ "obj-15", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-15", 0 ],
"destination" : [ "obj-16", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 1 ],
"destination" : [ "obj-16", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-16", 0 ],
"destination" : [ "obj-17", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-17", 0 ],
"destination" : [ "obj-18", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-18", 0 ],
"destination" : [ "obj-19", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-19", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-7", 0 ],
"destination" : [ "obj-20", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-20", 0 ],
"destination" : [ "obj-13", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
,
"saved_object_attributes" : {
"default_fontname" : "Arial",
"fontface" : 0,
"fontsize" : 12.0,
"default_fontsize" : 12.0,
"fontname" : "Arial",
"default_fontface" : 0,
"globalpatchername" : ""
}
}
}
, {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 86.0, 291.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-11",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 34.0, 345.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-10",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "metro 150",
"outlettype" : [ "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 34.0, 316.0, 65.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-9",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "toggle",
"outlettype" : [ "int" ],
"patching_rect" : [ 33.0, 264.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-8",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "s resetMatrix",
"fontsize" : 12.0,
"patching_rect" : [ 166.0, 100.0, 79.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-7",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 167.0, 75.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-6",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 97.0, 122.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-5",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 96.0, 74.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-4",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 32.0, 75.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-3",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p markovPitchAnalysis",
"fontsize" : 12.0,
"patching_rect" : [ 33.0, 168.0, 131.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-2",
"fontname" : "Arial",
"numoutlets" : 0,
"patcher" : {
"fileversion" : 1,
"rect" : [ 905.0, 341.0, 640.0, 480.0 ],
"bglocked" : 0,
"defrect" : [ 905.0, 341.0, 640.0, 480.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"visible" : 1,
"boxes" : [ {
"box" : {
"maxclass" : "message",
"text" : "clear",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 226.0, 108.0, 37.0, 18.0 ],
"numinlets" : 2,
"id" : "obj-6",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "r resetMatrix",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 225.0, 68.0, 77.0, 20.0 ],
"numinlets" : 0,
"id" : "obj-5",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "coll pitchMatrix",
"outlettype" : [ "", "", "", "" ],
"fontsize" : 12.0,
"patching_rect" : [ 41.0, 155.0, 90.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-4",
"fontname" : "Arial",
"numoutlets" : 4,
"saved_object_attributes" : {
"embed" : 0
}
}
}
, {
"box" : {
"maxclass" : "message",
"text" : "merge $1 $2",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 40.0, 112.0, 78.0, 18.0 ],
"numinlets" : 2,
"id" : "obj-3",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p pair",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 40.0, 70.0, 41.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-2",
"fontname" : "Arial",
"numoutlets" : 1,
"patcher" : {
"fileversion" : 1,
"rect" : [ 885.0, 123.0, 640.0, 480.0 ],
"bglocked" : 0,
"defrect" : [ 885.0, 123.0, 640.0, 480.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "pack",
"outlettype" : [ "" ],
"fontsize" : 12.0,
"patching_rect" : [ 126.0, 227.0, 36.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-6",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "i",
"outlettype" : [ "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 122.0, 181.0, 32.5, 20.0 ],
"numinlets" : 2,
"id" : "obj-5",
"fontname" : "Arial",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "t i b i",
"outlettype" : [ "int", "bang", "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 121.0, 128.0, 46.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-4",
"fontname" : "Arial",
"numoutlets" : 3
}
}
, {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 119.0, 78.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-3",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "outlet",
"patching_rect" : [ 127.0, 271.0, 25.0, 25.0 ],
"numinlets" : 1,
"id" : "obj-2",
"numoutlets" : 0,
"comment" : ""
}
}
, {
"box" : {
"maxclass" : "inlet",
"outlettype" : [ "int" ],
"patching_rect" : [ 118.0, 31.0, 25.0, 25.0 ],
"numinlets" : 0,
"id" : "obj-1",
"numoutlets" : 1,
"comment" : ""
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 0 ],
"destination" : [ "obj-5", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 1 ],
"destination" : [ "obj-5", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-4", 2 ],
"destination" : [ "obj-6", 1 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
,
"saved_object_attributes" : {
"default_fontname" : "Arial",
"fontface" : 0,
"fontsize" : 12.0,
"default_fontsize" : 12.0,
"fontname" : "Arial",
"default_fontface" : 0,
"globalpatchername" : ""
}
}
}
, {
"box" : {
"maxclass" : "inlet",
"outlettype" : [ "int" ],
"patching_rect" : [ 38.0, 28.0, 25.0, 25.0 ],
"numinlets" : 0,
"id" : "obj-1",
"numoutlets" : 1,
"comment" : ""
}
}
],
"lines" : [ {
"patchline" : {
"source" : [ "obj-1", 0 ],
"destination" : [ "obj-2", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-2", 0 ],
"destination" : [ "obj-3", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-3", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-5", 0 ],
"destination" : [ "obj-6", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
, {
"patchline" : {
"source" : [ "obj-6", 0 ],
"destination" : [ "obj-4", 0 ],
"hidden" : 0,
"midpoints" : [ ]
}
}
]
}
,
"saved_object_attributes" : {
"default_fontname" : "Arial",
"fontface" : 0,
"fontsize" : 12.0,
"default_fontsize" : 12.0,
"fontname" : "Arial",
"default_fontface" : 0,
"globalpatchername" : ""
}
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "p loadMIDIfile",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 32.0, 98.0, 84.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-1",
"fontname" : "Arial",
"numoutlets" : 2,
"patcher" : {
"fileversion" : 1,
"rect" : [ 929.0, 275.0, 640.0, 480.0 ],
"bglocked" : 0,
"defrect" : [ 929.0, 275.0, 640.0, 480.0 ],
"openrect" : [ 0.0, 0.0, 0.0, 0.0 ],
"openinpresentation" : 0,
"default_fontsize" : 12.0,
"default_fontface" : 0,
"default_fontname" : "Arial",
"gridonopen" : 0,
"gridsize" : [ 15.0, 15.0 ],
"gridsnaponopen" : 0,
"toolbarvisible" : 1,
"boxanimatetime" : 200,
"imprint" : 0,
"enablehscroll" : 1,
"enablevscroll" : 1,
"devicewidth" : 0.0,
"boxes" : [ {
"box" : {
"maxclass" : "newobj",
"text" : "s finished",
"fontsize" : 12.0,
"patching_rect" : [ 335.0, 348.0, 61.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-13",
"fontname" : "Arial",
"numoutlets" : 0
}
}
, {
"box" : {
"maxclass" : "button",
"outlettype" : [ "bang" ],
"patching_rect" : [ 288.0, 216.0, 20.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-12",
"numoutlets" : 1
}
}
, {
"box" : {
"maxclass" : "number",
"outlettype" : [ "int", "bang" ],
"fontsize" : 12.0,
"patching_rect" : [ 86.0, 276.0, 50.0, 20.0 ],
"numinlets" : 1,
"id" : "obj-11",
"fontname" : "Arial",
"numoutlets" : 2
}
}
, {
"box" : {
"maxclass" : "newobj",
"text" : "stripnote",
"outlettype" : [ "int", "int" ],
"fontsize" : 12.0,
"patching_rect" : [ 85.0, 227.0, 57.0, 20.0 ],
"numinlets" : 2,
"id" : "obj-10",
"fontname" : "Arial",
Lee, your patch didn't make it through intact, probably because of some forum post size restriction.
I'm going to give similar advice to Vanille, anyway. You don't really need the chord itself really, just a reversible hash that can be stored and looked up. In my ScaleMaster patcher I use this technique to make a hash of scales that can be between 1 and 12 notes.
I store the scales in a coll in interval format. Here's a major scale:
Major, 1 2 3 4 5 6 7;
I make a hash of that to create this symbol that represents the notes in a scale: s1234567
It has a leading letter to ensure that it is treated as a symbol (which gets around any number length issue)
As long as your hash function will create a unique symbol for each collection of notes, and is reversible, it should work for your purposes.
Vanille - This works perfectly! Thanks alot, it's really helpful! Also, thanks for the copy compressed tip, I've been wondering how people generate that code for ages :P
Chris - I dont quite get your method as I dont know much about the whole hash and symbols method, but I did approach my patch at first using Peter Elsea's chord and melody method of storing chords and melodies in coll Major Triad: 0 4 7
Major scale: 1 0 1 0 1 1 0 1 0 1 0 1 (degrees of major scale)
But my method of just storing chord and note probability data in markov chains using coll is exactly what I need and avoids me having to even implement a system of representing musical parameters such as chords and scales in my patch. I just need to analyse a few songs, generate markov chain data from the analysis (I will make sure they are analysed from the same point of reference (key) and using the degrees from 0 - 11 to represent the notes instead of actual midi numbers).
However I am very interested to see how you have built your scale master because as I said above, I dont really get what you mean, and also I would like to try and get an understanding of as many different ways as possible. If you could share it that would be great but I understand if you dont want to, so no worries :)
Thanks for the help and suggestions all!
Lee
Here's a patcher that illustrates what I was on about:
(Vanille and I were going in roughly the same direction)
@Winterheartlee:
1) Please use Copy Compressed.
The whole reason Copy Compressed was implemented was so that the forums wouldn't be flooded with incomplete uncompressed patches that you have to spend endless amounts of time scrolling through.
Use copy compressed, dammit. Or upload the patch as an attached file.
2) You can concatenate numbers with arithmetic:
Top 2 digits * 100000000
+ next 2 digits * 1000000
+ next 2 digits * 10000
+ next 2 digits * 100
+ last 2 digits.
This works within the limits of 32-bit integers.
Thanks again both!
Christ I get what you mean now, I particularly like your way because I can still see the numbers inside the coll which means I can tell what chords they are and add my own chords if necessary.
Lee
Thanks for the advice Peter,
Yeah sorry about not using copy compressed, I didn't know about it at the time (only started posting on this forum a few days ago so this was the first time I've had to post the patch code)
Heres the markov chain patch again anyway just incase someone is searching for markov chains in the future and gets excited until they try and paste my incomplete code into their patcher :P
This was built using this tutorial:
Lee
Ah awesome!
Thanks again Vanille
2 days ago I had no way to achieve what I wanted, now I have multiple options! lol
Lee