Oct 11 2010 | 1:27 am

I am creating a time based effect patch that falls in to a predetermined interval, and I need help with the math involved.

What I am looking to do is change playback speed of a buffer for a selectable amount of time, with selectable ramp-up to speed curves.

Example: You could choose to playback 1 bar of a sample in the space of a half note. But, I would like the user to be able to select from several different ramp-up curves, and i'm unsure of how to calculate the time compression on those.

To distract you from my lack of math skills, I have created a diagram to highlight my lack of drawing skills instead.

Thank you for the help

[attachment=143329,1228]

- Oct 11 2010 | 2:23 pmi mostly get the point except one thing, do you need to know the ramp time in orderto calculate the curves or do the curves already exist and you need to find out the pitch?normally you should be able to find the ramp time with the same expression which madethe curve.i assume that even if you use ln(cos*pi) or a random path for your curve, the relationbetween playspeed and pitch is always contained one point, and this where you should start.build a version with a linear (frequency) ramp and one with a linear (playspeed) ramp andtry to find out how they have to be calculated.otherwise a patch would be helpful.-110
- Oct 11 2010 | 2:41 pmlet me rephrase my answer. what are the values you have, and what are the vaues we need to calculate?
- Oct 12 2010 | 12:39 amwell, i haven't started creating the curves yet, and honestly its not something i've done before so i'll figure it out when i get there.what i'm asking (a.k.a. what i don't understand how to do) is,given variable tempo and variable target / source duration, the curve will take a certain percentage of time, and the rest of the sample played back at new speed will take a certain amount of time. i'd like to have the total duration of these two events fit into a predefined duration. say, 1 half note, or a dotted eight.perhaps it will become more clear when i start working with the curves, but since my math skills are somewhat weak, i'm intimidated to get lost for hours trying to figure a solution to a problem for which someone has already created an object.when i get closer to a sensible patch, i'll post it ;)
- Oct 12 2010 | 1:46 amthere is definetly no ready to use object, but eventually parts of it.it is not a very simple problem.one thing which comes to mind is that it should be enough to calculate the averagespeed of the curve (the mean of all pitches, sample by sample.)i might come back to this later.
- Oct 12 2010 | 2:12 am[edit]don't know how my comment got posted twice, so i am deleting it.
- Oct 12 2010 | 2:12 amOk! I may try the averaging for now, although ideally I am looking to have several dj-style non-linear speed ramps.If you get a chance & have the willpower to wade through it, here is my patch so far. I don't have a simplified patch with only the problem area included, but I have used some colored comments to at least guide others to the problem area.If you don't have a solution for this currently, it's ok. It will get sorted out eventually. I might just learn something new in the process, the hard way;D
- Oct 12 2010 | 1:07 pmi dont have max5 here, maybe you can serve me a picture of the unlocked patcheror a .maxpat file with all cords visible.
- Oct 13 2010 | 1:48 amThis method will _only_ work for linear (straight-line) playback-rate change ramps...If D is the duration in seconds of your source sample, and T is the target duration for its playback, and t is the time it takes to ramp up to the new playback rate, then the playback rate you need, R, is:R=(D-t/2)/(T-t/2)Obviously t needs to be less than T.I just worked this out with pencil and paper, so you might want to verify it first...EDIT: this formula is worked out assuming you start at unity playback rate (ramp starts at unity). Also target duration can be greater or less than source duration. Also R is the rate _factor_, ie 2 is twice playback speed etcT
- Oct 13 2010 | 2:09 ambtw if you want a ramp back to the unity playback rate which takes the same time as the beginning ramp, then it's:R=(D-t)/(T-t)t has to be less than _half_ of T
- Oct 13 2010 | 4:12 am@roman well, i'm not quite sure how i can take pictures of this patch that would be useful to look at without interacting with it. i'll take a few pics of the patch & put them somewhere to look at.@terry thanks! i'll work that out in maxland and implement it. it should stand in well until i can figure out this nonlinear ramp business. in might in fact help me look at this problem differentlythanks for the input! i'm gonna tackle this tomorrow.