Forums > MaxMSP

midi manipulation patch


REC
July 4, 2007 | 12:40 am

Hellooo all,
Yes i’m new to Max/msp and i have read all the max tutorials… i’m about to start the msp section. But i wanted to try making my own max patch before jumping into the audio aspect. Basically i’m trying to create a patch manipulte midi sequences i’ve created in logic in realtime. I have a few i deas of how to do this but i’m hoping maybe some of you could give me some pointers or ideas on how to accomplish these ideas. Sorry if this is way to long for a post, but where else can i turn.. so please just bear with me. First the things i’d like it to do. Reverse the sequence (ie..last note played first, first note last), changeable loop start and end times, appreggiate, Randomize played notes, Stutter, quantize change, delay, thats it for now.
So i figured i’d start one at a time.. so i decided to just try and reverse a given sequnce. From what i’ve gathered from the tutorials, the table object would be the best place to start for all of these (). Once i have the seq in tha table it seems like it shouldn’t be to hard reverse the index by sending it though the swap obj or something.. But this would just swap velocity with pitch of one note not the order of a whole series of notes. In tutorial 48 they do have a reverse code in jave script maybe i could cut and paste, but could someone give me an idea of how reversing a seq can be done with control objs. The more i think about it the harder it seems. Can i tell max to read through the table backwards? And to loop at certain points in the table?
Maybe i should complete the msp section, as it seems like the things i’d like to do with the midi sequnce table are done quite often in the audio table… Like changing loop times. Maybe i could use a similar set up to read thtough a midi note table. Anyway, i realize i have a long way to go and this patch might be way more than i can handle but at least it gets me thinking. So if someone could give me some pointers that’d be great


July 4, 2007 | 2:41 am

I would look into using coll to store the data, because you can keep more info at each index (compared to table).

I’ve done some patches that do the reverse (aka retrograde) of a sequence but it is a bit tricky, especially in real time.

Theres number of things to consider-

do you want the notes of the reverse sequence to be the same length as those recorded?
For this, you need to not only record the pitch and velocity of each note, but also their duration. This can be done with the [timer] object, but it gets more complicated if you are recording multiple simultaneous notes.

Do you want to record the time in between notes as well (aka inter-onset interval)?
This is also a job for timer.

So, if you wanted all of these things, you could use a combination of notein,timer, counter and coll (among others) to record the pitch, velocity and inter-onset interval of the note each note at a different index in coll. I would consider the inter-onset interval to be the time between the recorded note and the previous note.

Once you have all the notes of the sequence recorded into a coll, you have to get them back out, in reverse. You can use the length message to coll to see how many items, and then use that information to set the maximum of a counter.

You can use the pitch, velocity and duration information with makenote to create the note, and then use delay to set the timing between notes.

Also, I know you said you wanted realtime, but the easier way to do this in logic is with the transform functions in the matrix editor. To reverse, you simply set the loop points around the sequence you want, then go to functions->transform->reverse position.

This is not to try and discourage you from the patch! I think it would be a good (though difficult) excercise! I also think the approach of trying to get something out of what you already learned before going ahead is very good. It allows you to be creative with Max/MSP immediately and will help you much more than if you went through the MSP tutorials without any real-life max experience.

If I can come up with a simple patch to illustrate some of the stuff I mentioned, I will. But for now, its off to cook dinner!


July 4, 2007 | 3:24 am

At 6:40 PM -0600 7/3/07, Matthew Williams wrote:
> So i figured i’d start one at a time.. so i decided to just try and reverse a given sequnce. From what i’ve gathered from the tutorials, the table object would be the best place to start for all of these ().

Yeah, either table or coll, they both have good and bad points. I tend to use coll unless there’s a good reason to use table. For example, you would need two tables to hold pitch and velocity, but they could live in one coll. I’ve built sequence-like objects with both table and coll.

Anyway, reversing the order by reversing the index is really easy feed the number of notes in your sequence into the right inlet of the !- object, and the positive index into the right inlet. An example:

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 276 226 73 196617 reverse index;
#P comment 199 128 29 196617 rate;
#P flonum 224 127 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P toggle 176 126 15 0;
#P newex 176 146 58 196617 metro 200;
#N counter;
#X flags 0 0;
#P newobj 176 182 66 196617 counter;
#P number 177 247 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 176 207 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P hidden newex 264 81 48 196617 loadbang;
#P hidden message 264 103 20 196617 17;
#P number 264 126 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 177 225 97 196617 !-;
#P window linecount 2;
#P comment 302 125 100 196617 number of notes in your sequence;
#P window linecount 1;
#P comment 153 127 24 196617 Run;
#P fasten 3 0 8 4 269 174 237 174;
#P connect 3 0 2 1;
#P connect 11 0 9 1;
#P connect 10 0 9 0;
#P connect 9 0 8 0;
#P connect 8 0 6 0;
#P connect 2 0 7 0;
#P connect 6 0 2 0;
#P hidden connect 5 0 4 0;
#P hidden connect 4 0 3 0;
#P window clipboard copycount 14;

-C


Chris Muir | "There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue." – Brian Eno


July 4, 2007 | 4:01 am

ok. i couldnt help myself. Here is a patch to record a monophonic sequence (no overlapping notes!) and then play it back in reverse.

Play some notes from logic or whatever through notein. If you want to start over, initialize the patch by hitting the initialize button. When you have a sequence recorded, hit the playback in reverse button.

This patch requires that each note be fully off before the next one starts. You can probably make this patch polyphonic but it would take some work.

Along the way, I think I found a bug in the counter object, which I would talk about in another thread. It helped me find a more elegant solution, however, by iterating through the coll using the prev message.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 875 341 29 196617 gate;
#P message 894 318 31 196617 prev;
#P newex 1058 233 27 196617 != 0;
#P newex 768 81 31 196617 t b 1;
#P comment 674 249 93 196617 generate midi note;
#P newex 768 289 120 196617 noteout;
#P newex 768 247 94 196617 makenote;
#P newex 768 215 137 196617 unpack 0 0 0. 0.;
#P comment 942 290 100 196617 inter-onset interval;
#P newex 894 256 46 196617 t b f;
#P newex 894 289 46 196617 delay 0.;
#P button 768 57 15 0;
#P message 768 105 53 196617 end , prev;
#N coll noteList 1;
#P newobj 768 184 74 196617 coll noteList 1;
#P newex 449 189 61 196617 sel 1 0;
#P toggle 449 168 15 0;
#P hidden newex 15 121 65 196617 t clear 0 b b;
#P button 15 83 15 14;
#N coll noteList 1;
#P newobj 144 435 74 196617 coll noteList 1;
#P newex 185 363 62 196617 prepend set;
#P comment 256 334 146 196617 prepend index for each list;
#P newex 144 399 45 196617 prepend;
#P newex 144 303 51 196617 t l b;
#N counter;
#X flags 0 0;
#P newobj 185 332 66 196617 counter;
#P comment 488 222 156 196617 record inter-onset interval (IOI);
#P comment 488 236 143 196617 note-ons start and stop timer;
#P newex 449 220 35 196617 timer;
#P message 144 186 39 196617 set $1;
#P comment 273 163 102 196617 record note duration;
#P comment 273 191 98 196617 note-offs end timer;
#P button 235 126 15 0;
#P newex 213 97 32 196617 sel 0;
#P newex 144 276 72 196617 pack 0 0 0. 0.;
#P newex 235 166 35 196617 timer;
#P newex 144 54 149 196617 notein;
#P comment 219 278 146 196617 list: pitch velocity duration IOI;
#P comment 273 177 100 196617 note-ons start timer;
#P newex 235 189 29 196617 t b f;
#P comment 251 99 60 196617 Input Patch;
#P comment 30 85 100 196617 initialize (wipes coll);
#P comment 821 105 196 196617 go to the end of coll. output the last index;
#P comment 789 55 99 196617 playback in reverse;
#P comment 294 55 100 196617 from logic;
#P comment 701 292 66 196617 back to logic;
#P comment 907 343 94 196617 stop after one loop;
#P comment 931 319 139 196617 iterate to the previous index;
#P fasten 32 1 43 0 794 204 1063 204;
#P lcolor 15;
#P fasten 43 0 45 0 1063 316 880 316;
#P lcolor 15;
#P fasten 45 0 32 0 880 373 663 373 663 162 773 162;
#P connect 44 0 45 1;
#P connect 35 0 44 0;
#P connect 33 0 32 0;
#P connect 32 0 38 0;
#P connect 36 1 35 1;
#P connect 36 0 35 0;
#P connect 38 3 36 0;
#P connect 38 2 39 2;
#P fasten 39 1 40 1 857 276 828 276;
#P connect 38 1 39 1;
#P connect 39 0 40 0;
#P connect 38 0 39 0;
#P connect 42 0 33 0;
#P connect 34 0 42 0;
#P hidden connect 29 3 19 1;
#P connect 31 1 19 1;
#P hidden connect 29 2 19 0;
#P connect 31 0 19 0;
#P connect 30 0 31 0;
#P hidden connect 29 1 13 0;
#P hidden connect 29 1 13 1;
#P hidden connect 29 1 13 2;
#P hidden connect 29 1 13 3;
#P hidden connect 29 1 22 2;
#P hidden connect 29 1 30 0;
#P connect 15 0 12 0;
#P fasten 15 0 30 0 240 154 454 154;
#P fasten 14 0 12 1 218 155 265 155;
#P lcolor 7;
#P connect 12 0 8 0;
#P fasten 14 1 13 1 240 120 169 120;
#P lcolor 10;
#P connect 14 1 15 0;
#P lcolor 10;
#P connect 11 1 14 0;
#P fasten 19 0 13 3 454 262 209 262;
#P connect 22 0 26 0;
#P connect 23 1 22 0;
#P fasten 8 1 13 2 259 246 189 246;
#P connect 24 0 27 0;
#P hidden connect 29 0 27 0;
#P fasten 26 0 24 0 190 389 149 389;
#P connect 23 0 24 0;
#P connect 13 0 23 0;
#P connect 18 0 13 0;
#P fasten 8 0 13 0 240 239 149 239;
#P connect 11 0 18 0;
#P hidden connect 28 0 29 0;
#P window clipboard copycount 46;


July 4, 2007 | 4:03 am

oh. the [t b 1] on the playback section doesnt need to be there anymore. I was originally using it to open the gate at the bottom of the patch, but i found a better way.



REC
July 4, 2007 | 2:23 pm

thank you guys so much for the replies, they really help. B4 you guys responded, i came up with a very basic way to read a sequence in reverse by using the counter. By setting the argument to 1 (down). So in theory i can gate the original seq to the counter when i want to read through the table in reverse. And by puting int number boxes in the inlets i can also change the loop times via min and max. the only problem now is how to get the table or coll object to receive , for example, just 8 bars of music. also i’m having trouble understanding how to sync the counter to the tempo of the seqs i’ve recorded into the mtr object. i know i can set a metro to the counter. But this isn’t really helpful when using a previously recorded seq in mtr. It seems to me that mtr doesn’t really record tempo info, rather it just plays back whats been recorded.

nick thanks for the example patch… very helpful

matthew



REC
July 4, 2007 | 2:36 pm

This is not to try and discourage you from the patch! I think it would be a good (though difficult) excercise! I also think the approach of trying to get something out of what you already learned before going ahead is very good. It allows you to be creative with Max/MSP immediately and will help you much more than if you went through the MSP tutorials without any real-life max experience.

nick, yeah i realize this… but like you said realtime is very import as this patch would mainly be for live performances. I’m a drummer at heart so it’s really important for me to do some sort of realtime beat creation or manipulation. This is one of the main reason i bought max/msp.. for live perfomances.. I’m still goiung to use Logic as my main sequencer and workhorse, but i hope max will help me in the improv and live realm. So as a song plays in logic i’d like to send the midi drums to max and rearrange and tweak and send them back.. So i’m starting here.. Also the appregiator object in logic is a great… but since i’m send the info to max i might aas well be able to appregiate while its there.

thanks again, matthew


July 4, 2007 | 8:52 pm

I would definitely use seq, not mtr, for note recording. mtr doesn’t seem as accurate, and it won’t create MIDI files. It’s better for recording controller / interface object automations… like selecting different presets, changing sliders, etc…

Coll is generally preferable to table because of the multiple-item lists. However, the graphical editor in table (or multislider, for that matter) is nice. If you had several tables, one could do pitch, one velocity, one duration, on effects level, etc. Then each access gets the value from that index in all the tables, assembles it (probably in a pack) and that’s used to make the note.

With a bit of trickery and some understanding of coll, you can use the fact that table bangs out the right outlet when it’s edited. Each time it bangs, use an uzi with the table length to bang out all the values and store them in an index in coll. Advance the index each time. This will create a table history / Undo state list you can scroll through, VERY handy!

Reversing or otherwise scrambling the playback is pretty dead simple with counter. Try a Range Bar, set to the total table length, to visually set the min and max of the counter.

Also try the modulus (%) — then you can have a counter that’s the full range (or not) , and as it sweeps through, it only plays every 2nd note, every 3rd, etc. Use (for example) % 4 –> sel 0. This will only bang on 0,4,8,12….. very handy.

Random, urn, and drunk objects are also quite useful for this kind of accessing. Though they may seem not as controllable, you can always go back to plain old "play it forward or backward". But Max is all about trying new ways of storing, manipulating, and accessing your data for new possibilities. I think you’ll be pleasantly surprised at what you can generate, and just might get hooked. I know I sure did!

–CJ



REC
July 5, 2007 | 2:50 am

Quote: seejayjames wrote on Wed, 04 July 2007 14:52
But Max is all about trying new ways of storing, manipulating, and accessing your data for new possibilities. I think you’ll be pleasantly surprised at what you can generate, and just might get hooked. I know I sure did!
>
> –CJ

I’m a little intimidated by max at the moment. As it seems like most of you guys are more computer savy than i am. I’m by no means a computer wiz. so while you guys understand max with one read of the tutorials.. i have to read them like 5 times b4 i understand whats really going on. I look at patches some of you guys make and i’m like Damn i’d never be able to think of all that.. But maybe everyone goes though this in the begining. Do you guys? But maybe thats where max separates itself from other programs. Most people might give up on using max (as it’s too hard), but the people who perservier (sp) reap the rewards. I’m getting the hang of it .. i hope.. still wonder if i have the brains for max :(. i def have the will.

thanks for responding guys, matthew


July 5, 2007 | 3:25 am

hey matthew. I understand how you feel, I went through the same when starting max/msp, even though I had a background in text based languages. You just need to learn how to walk before you can run… after making many patches, you start to develop ways to think in max. IMO it will take quite a bit more than reading through the tutorials to get a handle on it, so start playing around! have fun :)


July 5, 2007 | 3:57 am

You will get better! Just keep at it. Many of us have been using max for a long time. I’ve been using it for about four years. There are people on this forum who have been using it since the early 90s.

I started out without a programming background. I had about four years of synthesis background before, though. Later on, I decided to minor in computer science. This helped,but I don’t think it is at all necessary to become good with the program.

The more you use max, the more you easily it will come. The trick, in the beginning, is to get the right balance of learning new stuff and making music with what you already know. There was a time when I really had to sit down and think about how to use play~ with line~ to create a sampler…or how to create a sequencer with counter and multislider. This stuff is second nature now. It will happen to you too!

I would say that to start, trying making useful patches out of stuff the is mentioned in the tutorials. Start with small goals.

Also, write down your ideas in a notebook or a text file. Read the notes every once and a while. I find that I might have some vague idea for a patch, and then a year later I will suddenly know how to do it. Right in the middle of dinner.


July 5, 2007 | 8:06 am

Matthew Williams schrieb:
> I’m a little intimidated by max at the moment. As it seems like most
> of you guys are more computer savy than i am. I’m by no means a
> computer wiz. so while you guys understand max with one read of the
> tutorials.. i have to read them like 5 times b4 i understand whats
> really going on.

You seem to be faster than I was… ;-)

> I look at patches some of you guys make and i’m like Damn i’d never
> be able to think of all that.. But maybe everyone goes though this in
> the begining. Do you guys?

Absolutely yes, if I look at my old patches, and there are a lot still
in its ancient state in my collection, I suddenly realise, that it took
quite a while to get fluid…

> Still wonder if i have the brains for max :(. i def have the will.

If u need only 5 times b4 u understand, you surely got the brains…

Most of learning Max is learning all the objects. Its a lot, and it will
need time to get them into your brain. Even after almost 20 years of
patching, I still stumble across objects which had been there from the
very beginning, and I didn’t used or even knew them…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


July 5, 2007 | 8:11 am

Nick Inhofe schrieb:
> I find that I might have some vague idea for a patch, and then a year
> later I will suddenly know how to do it. Right in the middle of
> dinner.

Its so hard then to not snub everybody, jump up without explanation, run
to the computer and hack it in… They might put you into the nuthouse,
a bad place for patching because of all the drugs…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


July 5, 2007 | 10:39 am

Yes, Max is truly ridiculous in its "never-endingness". My biggest problem has been over-experimentation without aiming towards specific products or projects. It’s definitely better if you think modularity from the beginning and only make ONE audio recorder, ONE of each basic sequencer element, ONE audio filter, etc… that you can assemble and iterate and build upon, using it in future patches.

Usually I try to keep adding too many elements to a particular patch and I wind up not utilizing the previous patching experience I’ve already banked. The potentially re-usable elements are too embedded / connected into their own patch, they’re not modular enough to simply copy a piece and paste it into the current patch. This is definitely not recommended….do your elements right the first or second try, then know where they’re at for easy re-use and you’ll save tons of time. Organization is key. Spend much more time conceptualizing rather than actually patching, ideally.

The best learning I got was from browsing through the help files—with each one follow all the "See Also:" objects at the bottom. As you come to understand what they can do (sometimes without even needing to try them out very much) you’ll start to get ideas about how you can expand your patch ideas, or do things way more efficiently. And yes, I (and I’m sure most people on this list) have read the Help files / tutorials / manuals for certain objects a LOT of times… there’s just no way to "get it all" on one read, especially as your projects and needs change.

There’s always objects that one overlooks, but if you have a good familiarity with most of them, you can get most of what you want done. That doesn’t mean you’re doing them in the most efficient way, though, as many excursions onto this forum have taught me—so often I’ll find a patch (or a piece of one) on here and it’ll smack me in the head like a ton of bricks, saying, "THIS is how you need to do… X Y Z!" …and I realize something I’ve been struggling with has been done so elegantly and easily, quite possibly in a completely different context. Lots and lots of good ideas and possibilities here.

If you have the will and are a tinkerer and like to mess with music / digital data, Max is definitely for you, I guarantee you won’t be disappointed. It’s pretty much steered me away from traditional music composition towards software interface design for my desired career… I just can’t get enough of it. Not to mention its rapidly-evolving bridges to other well-established environments (C, Java, JS, OpenGL, Flash) — it is definitely poised to be a contender for *the* controlling interface for all sorts of other software and programming environments.

Most people don’t have the patience for delving hard-core into coding… but many of these people respond well to a graphical environment where the data flow and logic is evident. That’s the whole point of it and I think it has a huge future in "data jockeying" — which seems to be what everything’s about these days, particularly in the creative digital arts worlds.

–CJ


July 5, 2007 | 11:08 am

—– Its so hard then to not snub everybody, jump up without explanation, run
to the computer and hack it in… They might put you into the nuthouse,
a bad place for patching because of all the drugs…

That’s awesome, what about when you leap out of bed because you figured out your patching problem in your sleep?

Maybe then it’s time to take a break…. or not.

……………….

I wonder if those very same nuthouse drugs might give crazy new insights into using Max??

–CJ


July 5, 2007 | 10:23 pm

Seejay James schrieb:
> Usually I try to keep adding too many elements to a particular patch
> and I wind up not utilizing the previous patching experience I’ve
> already banked. The potentially re-usable elements are too embedded /
> connected into their own patch, they’re not modular enough to simply
> copy a piece and paste it into the current patch. This is definitely
> not recommended….do your elements right the first or second try,
> then know where they’re at for easy re-use and you’ll save tons of
> time. Organization is key. Spend much more time conceptualizing
> rather than actually patching, ideally.

I would only partially agree here, There are a lot of things I do over
and over again and again, its not waisted time, its just the process
which is necessary to define it as something reusable. On the contrary,
its very unlikely, that you can do it "right" the first or second try.
But each time you do the same thing again, you learn more about the
basics of common problems, the more you solved them in different ways,
the closer you’ll finally get to a really reusable solution. You’ll
immediately know, when it happens, as you start to reuse some of your
code…

If I look back at my old code, I often can’t understand why I didn’t do
it right the first time, but the time I did it first was really a
different era… ;-)

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com



REC
July 6, 2007 | 1:16 am

Quote: Nick Inhofe wrote on Wed, 04 July 2007 21:57
—————————————————-

>
> The more you use max, the more you easily it will come. The trick, in the beginning, is to get the right balance of learning new stuff and making music with what you already know.
>
>
>
—————————————————-

yeah.. i’m definitely running into this problem already.. Right now i’m spending time reading and doing tutorials, time i would’ve used making songs in logic. I work full time so i have like 3 or 4 hours in the evening to do music (if that, if i’m not too tired). So i use most of this to learm max.. my music output has def fallen off since i’ve gotten this program, but at the same time i don’t want to wait years before i can do something with max. so i hope this time i’m spending pays off, so i can get back to making music and less time figuring out how to make the tools to make the music better.


July 6, 2007 | 10:27 am

Quote: REC wrote on Thu, 05 July 2007 18:16
>
> my music output has def fallen off since i’ve gotten this program, but at the same time i don’t want to wait years before i can do something with max. so i hope this time i’m spending pays off, so i can get back to making music and less time figuring out how to make the tools to make the music better.
—————————————————-

I’ve gone through this recently (and am still going through it to some extent), but I’d have to say depending on your goals and motivation it is entirely worth it! I think because you are mention making tools to make music better, you will find Max is a good fit.

For years I had been bouncing around from one sequencing and synthesizer software to the next, never quite finding something that let me express my ideas the way I wanted to. I’ve become completely addicted to Max because for the first time in my life I feel like I can make the computer do what I want it to without needing to program everything from scratch.

Using Max is really hard work sometimes, but it will pay off if you stick with it. The best part is you start to build up your own personal patch library over time, and if you try to design things to be modular and reusable (you’ll get better with that in time), then you have a nice library of tools designed specifically for your needs and it shouldn’t take as long to throw together something for the current project at hand.

In any case, I definitely wasted a few months just building patches and not really making music, but I am slowly figuring out that I need to set some clear music making goals and not get distracted by all the patch building. I guess I am just repeating what other people have already said, but here’s a couple ideas if you want to actually make some music:

Start *really* simple. Just build your sequencer reverser or an arpeggiator or whatever and try using that in conjunction with your normal Logic sequencing. I think the list you mentioned in your first post is a good one, but don’t try to do it all at once.

Test your patches out by using them to make a song as soon as they are semi-functional. I wish I had started doing this sooner instead of just tinkering around for so long. It’s not until I try making a full-fledged song with my patches that I realize what’s working and what’s not, and I get a bunch of ideas for new features. Now if only I could learn to follow through and complete a song…

Besides the help files and tutorials, read the forums and download and play with patches other people have made. I’ve gotten some really good ideas this way. And there’s lots of other resources too, like maxobjects.com

Good luck!

Adam


Viewing 18 posts - 1 through 18 (of 18 total)