Non-linear playback of a specified length without looping

Oct 21, 2012 at 5:28pm

Non-linear playback of a specified length without looping

Hi everyone,

I’ve had a look around on the forums but can’t find what i’m looking for.
Basically I’ve loaded audio into a buffer, and I want to play back from a random ms point in the buffer, and play for a specified length in ms, then stop. It seems simple but I just can’t figure it out. It’s been a while since I’ve been on MaxMSP.

This is my attempt so far. You can probably see what I’m trying to achieve but I’m probably not using a couple of objects in the right way.

Hope to hear from you soon!

Thanks,

Matt

– Pasted Max Patch, click to expand. –
#64856
Oct 21, 2012 at 6:55pm

You look like you’ve got groove~ plugged into play~. This, although interesting, is probably not what you are going for. You only need use one of them. Have a look at help file for groove~ that should sort you out.

#233852
Oct 21, 2012 at 8:26pm

Hallo,
I didn’t look at your patch but, if you require unchanged pitch then: if your audio file is, for example, 2000ms long and you wish to play from 500ms to 1200ms, subtract the chosen startpoint from endpoint (= 700ms); divide 1000ms by this value ([!/ 1000.}, to give a [phasor~] freq for [play~] and this will play ANY segment at the original pitch. You’ll need some enveloping to avoid clicks of course.

Brendan

unless your relying on [groove~], but the maths is pretty much the same.

#233853
Oct 21, 2012 at 9:47pm

as the “nonlinear” is not defined, there is no way of calulating when the time is over.

only if the speed is linear segments with breakpoints or a curve of known paramters you could
calcualte the duration.

the solution is pretty simple though:

make a parallel running buffer and play/groove objects with a sample inside which
goes like 1,2,3,4,5 … and play that the same way than your audio material.

when it reaches >=~ 88199 , two seconds of discreet time are over – no matter how
they were played (including backwards!)

p.s.: or better: if you use < ~ 88199 you can use its output of 0. and 1. to control the
gain of groove/play to make sure that it is muted exactly after the last sample.

-110

#233854
Oct 22, 2012 at 4:29am

From your patch, it looks like you intend to play it with constant speed, even if Roman’s point is relevant (at first, before looking at the patch you made, I also thought you meant varying speed). If that’s what you want to do, here’s something. Can the big men here confirm there’s no bullshit in it ?
Didn’t work out the possible clicks problem because I work at 5AM in my hotel room, without headphones ! Now I’m going to try to patch it the way Roman describes it, to add the possibility of varying speed.

PS : Roman, what do you mean by ‘with a sample inside which goes like 1,2,3,4,5′ ?

– Pasted Max Patch, click to expand. –
#233855
Oct 22, 2012 at 11:28pm

a sample which … looks like the output of index~. first sample at 1. ,second at 2. and so on.

the 32 bit limit wont be a problem.

but when i think about it … i am not sure how we should create this buffer.

initialising it via poke~ is probably a bad idea so i think one should work with a signal file from disk.

nice that you try to build it.

i will look where i have my rough version of this, bring it uptodate, an add it here, too.

-110

#233856
Oct 23, 2012 at 12:08am

when i think about it a bit more, couldn´t one just do the same with a signal accumulator? i will try tomorrow. -110

#233857
Oct 23, 2012 at 7:06pm

Sorry guys, I should elaborate and tell you my plan.

So I’ve made the following my experimental sound project for uni:

I plan to use the Pascal’s triangle. The numbers will relate to “sample” length (I don’t actually wish to sample in the conventional sense, just play from a certain point in an audio file for a specified length of time). I thought splitting the numbers into columns would be best, and then sequentially going down the colums, so as one “sample” stops the one directly below begins and so on. So therefore there will probably be a separate playback feed for each column right?
If you can imagine, the “samples” would gradually increase in size, and there would be more and more layers. So the aim is to go from 1ms samples up to around 12 seconds, but only using the values of pascal’s triangle to increase the sample sizes and they will be in columns as I mentioned.

I’ve extensively looked at the help files on the individual objects and can’t find exactly what I need to know of them.
It doesn’t sound like it is a complex idea but the part which I imagine to be the hardest is what I mentioned in my first post
i.e. I will be loading in an audio file. Then I want to press GO and it will find a random point in the file, play for 1ms, then find another point in the song, play for 2 ms, another point 6ms, another point 20ms. and so on.

Each column will be fixed in a panning position also.

I hope this makes sense? :/
slightly worrying myself now as i’ve committed to it

#233858
Oct 23, 2012 at 7:23pm

@Stephane I just took the time to mull over what you did, and after a few minutes of digesting it makes sense to me now, and it works just as I need it to. Thank you very much! :)

And thank you everyone who contributed, you’re all fantastic :) it’s great to have people to go to when you feel like you’re going to pull your hair out!

#233859
Oct 23, 2012 at 7:26pm

just so people know this is what I was looking to achieve:

– Pasted Max Patch, click to expand. –

is there a simple way to envelope a sound so that there are no clicks/pops/peaks? Because the problem I guess is that i’m using such small sample sizes that I wonder is it possible to fade something that is only a few ms long??

Perhaps a more complex problem than fading is working out how I’m going to get it to play a consecutive set of values making sure that the first has stopped before the second starts

#233860
Oct 24, 2012 at 12:02am

so, to continue the confusion, i was wrong about my old example, it did something totally different.

for what stephane and me were discussing you dont even need counter and index.
you´d only need the modulation signal itself, or course.
in case the modulation signal is 0.-1 you can use 1.
otherwise you use the last sample value as trigger.
in the case of milliseconds one might need to think about it twice if a conversion to samples is really required or not. :)

-110

[attachment=206709,4579]

Attachments:
  1. findendforum.jpg
#233861
Oct 24, 2012 at 1:13am

So this is how far I’ve gotten so far :)

– Pasted Max Patch, click to expand. –

Do you think I would need to fade the samples? I’m ranging from 1ms to 12 seconds so… The problem is there will always be very tiny samples at the beginning of every column playback i.e. a 1ms sample which isn’t even heard really given the pace at which this thing evolves…
Opinions?

#233862

You must be logged in to reply to this topic.