AES 4 - time stretch


Things getting pretty heavy from here on in. Pretty comfortable pre-made ride until now with the existing effects.

04 sees us taking a look at time stretching. The act of lengthening or shortening a sample of audio and playing it back (normally in a loop).

The whole RAW 1 hour 23 minutes video is as always, at the bottom (That is longer than the original Airplane!, we aren't here to make your mind up... but we know which we would rather watch [the answer is ours]).

Genuinely, this was quite tough to get working as desired. We recognized fairly quickly that we were going to need to branch the main audio stream to sample into a buffer which we could reel out of later. Getting that to actually happen was another matter.

A deep dark dive into some of our own archive was require to get our head around holding, sampling and altering buffer data. The paint masterpiece below was our first foray back into the world of audio buffers.

We knew that the record~ object was probably going to be our friend (after making some mistakes with sfrecord)

We had to:

  1. Take audio from the main stem

  2. Record it into an undefined length buffer

  3. Hold it until required


  5. Play it out back into main stem

Whole load of steps to get to the effect we want.

We spend between 05:00 -> 15:45 in the video going through the processes needed to record a buffer, hold it and be able to play it back.

So avoid that part if you're some what familiar with what the words above mean.

Also dodge the next 15 minutes (15-30:50) unless you want to see us make the most complex trigger (eg we needed a 1 or 0) ever.

Really we get caught up in trying to make a trigger mechanism for the recorder but there is always a much simpler way than you originally think. Taking a step back can sometimes help.

The section is a very good insight into programmatic problem solving - so we might bring it up in other tutorials.

At this stage we are looking at something like this:

Top left is our recorder, top right our buffer and the bottom is our playback tool.

We use the groove~ object as our output object as it supports the input of a signal modulation (the slider and sig~ object) out of the box this is a simple high level time adjuster.

The next little bit of video is probably why we love doing what we do. Pure investigate programming.

Unlike tapin~ in the previous blog (AES 2) you cant variably change the length of a buffer after filling it with data. So we develop a pretty (in our heads) inventive way of playing back the sample the user wants to hear - vs a lot of empty space every loop (as the buffer will always be SUPER long to be ready for longer samples).

Check out 33:00-> 41:00 to see it all unfold (we still make mistakes while building it).

Differing from the previous we have some data joining our record~ and groove~ objects that set the looping points of the sample dynamically every time the user presses record.

After all of that was done:

we could finally start trying to implement the time alteration control. 41:00 -> 51:00 plays about with some ideas and controls for both the pitch and time.

All you need to notice is the addition of the timestretch toggle, adjusted slider and additional float number for pitch.

The remaining 20/25 minutes and the rest of our development time focus on general organisation and housekeeping of the patch above.

One of the things we note again is the announce of the slider controls within max. we might move over to floats/ints completely and manually create the ranges we need as the whole reset value thing is a nightmare to process mentally (we dont think in base 127 etc etc).

At 1:20:00 or so we implement something called a linedrive object which is an amazing tool that helped us overcome some of our ealier slider issues.

Overall a fairly thorough implementation. Still needs some tweaking overall but an interesting development.


More of the same nextime in AES5- Freeze(BUFFERS FOR DAYZZZZ)

Join the PfP mailing list