Controlling the speed and playback position of a sound.

I’d like to play back a sample in time with a movement (probably a wiimote gesture in future but a cursor movement is fine for now).

I’ve got no idea how to go about doing this but this video suggests it is possible, though I don’t need the gesture/ shape recognition, just the ability to scrub through a sound file with the speed of the sample increasing or decreasing relative to the input.

have a look at buffer~, groove~, play~,… for the sound part. And the cv.jit externals maybe. Jit.op and absdiff are your friends too. If you use max for live, there are devices (one is called ‘motion… something’) made to do this kind of things.

Thanks for the tips, though unfortunately I’m not a max for live user.

Here’s what I’ve got so far (taken from another thread on here). It almost does what I’m trying to do but ideally the pitch would remain constant and the sound would only be played when the slider value is increasing. I’m trying to use grainstretch to shift the pitch up relative to the slowness of the movement but I’m not entirely confident this will work.

— Pasted Max Patch, click to expand. —

Copy all of the following text. Then, in Max, select New From Clipboard.

Something went wrong pasting your patcher in, I think. I can’t open it.
Sounds a lot like granular synthesis, or fft analysis/resynthesis.
Using granular synthesis to pitch up what went down when you play back at slower rates is certainly interesting but somewhat missed the point of granular stuff.
With granular sampling you can play back an audio file at any speed without changing the pitch (there are downsides also as everywhere in life). There should be a nice example that come with max but I can’t find it right now.
But you can find tons of granular samplers online.
hope that helps
cheers