midi manipulation patch

REC's icon

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

Exit Only's icon

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!

Chris Muir's icon

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:

Max Patch
Copy patch and select New From Clipboard in Max.

-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

Exit Only's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

Exit Only's icon

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's icon

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's icon

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

seejayjames's icon

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's icon

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

Murrz's icon

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 :)

Exit Only's icon

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.

Stefan Tiedje's icon

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

Stefan Tiedje's icon

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

seejayjames's icon

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

seejayjames's icon

----- 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

Stefan Tiedje's icon

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's icon

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.

Adam Murray's icon

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