Using "function" to edit sound file velocity?

mudman113's icon

First off, I'm a complete beginner with max. So far I haven't been able to make anything I wanted without failing a billion times. Everything sounds like chinese to me except for things explained in baby language. (I fully understand that it's normal to suck at the start, I just felt like complaining about it. :P)
Now that I've got that off my chest, and you all know what kind of person you're dealing with, I would like to ask a question.
I have been trying for the last two hours at least to find a way to use the "function" graph to modify the velocity at which a sound file is being played. I have added an image of the setup I have so far.
Does anyone know what I have to add, and what to connect where in order for the velocity of the track to be controlled by the graph? Maybe what I'm trying is not even possible... if so, is there a way to edit the velocity of a track with some kind of graph, or anything? (besides editing the velocity manually with a number box)

Thanks,
-Mud

Souce_of_headache.png
png
Wetterberg's icon

first thing to do with any new object in max is to get acquainted with its help file. Like, really dig into it. More often than not you can get almost everything you need out of a helpfile.

In your case, open up the help file for [function].

At the top you'll see tabs, and the "sustain" tab has an example that does this exact thing.

And to really *grok* an object, look at its reference for all its possible commands. Lastly, if you haven't already, do take the time to go through the MSP tutorials (in the drop down menu, under "help"). At least the first bits are really useful to get your bearings in MSP-land. Oh, and definitely do all the Max tutorials too :)

There's a learning curve to all of this, for sure. But you'll be saving yourself a lot of time down the road by investing some time in the tuts right now.

Roman Thilenius's icon

you will often run into situations like that, you have two parts, and they dont really fit together.

when you want to control something like groove~ or play~ from function, you have to do two things:

- set the functions vertical resolution to 0. - 1.

- map the input range 0. - 1. to an output range of for example speed x0.25 - x4.

the latter is difficult, because it is not a linear conversion such as you could reach using [zmap 0. 1. 0.25 4.]

to map "linear" to "rate" or "playspeed" you can use this: [expr exp(0.057762265*($f1-0.5))]

mudman113's icon

But the setup found under the "sustain" tab in the help menu for "Function" is for amplitude modulation. I want to modulate the speed at which the sample is being played, so that you'll hear a really fast drum beat for a couple seconds, and then for instance that the file is stretched and you hear it going slower.
I know this is possible if I have a setup like the one in the image I added. Just tinker with the number in the top box that you see in the panel and the speed at which the track plays can be modulated. I want that same effect, but then that the graph is doing the editing.

Maybe I'm just not getting it, maybe you're right and that the example does show me the right information, I just don't know how to use it.
And I'm actually following a course on how to work with max, this is just one of those things I wondered, and that the course did not explain. Me coming to this forum and asking is a last resort, I have been trying way too long to solve this problem and have not been able to find the answer.

The_problem.png
png
mudman113's icon

@Roman Thilenius, I have no clue what [zmap 0. 1. 0.25 4.] or [expr exp(0.057762265*($f1-0.5))] are, or what to do with them...
Like I said, I'm following this course on how to work with max, and I'm just not that far yet. What I have to do is actually a task I have to do from this course from a book and it's supposed to teach me all these functions step by step. The only downside is that it doesn't give any answer sheets to these problems they give.
Could you maybe explain it in a simpler way?

Wetterberg's icon

@mudman113: You're being too literal in your approach to what you're seeing.

The "sustain" example generates a control signal. In the example given that control signal controls amplitude. Max lets you plug that signal in elsewhere, and I'd reckon the inlet on the groove~ object is a good idea...

mudman113's icon

Oh, well that's weird... all I had to do was connect the wire from the second output to line~ and then to the left input of groove~ and it did what I wanted to!
For some reason it wouldn't do that yesterday, instead of adjusting the rate that it would play, it just played it at a normal rate the entire time if I did that.
I already thought that that's what had to be done from the start... Maybe I missed a connection, or messed up something small that was of big consequence.
Anyhow, thanks for the help! I can now move on with my life.

Roman Thilenius's icon

we use the [] brackets to express an object box.

Stephane Morisse's icon

BTW, this comes from the Giri and Cipriani book Vol 1, you should read the preceding chapters before diving in the examples, you will complete the activities in no time...