Sampling

samtaylor844's icon

Basically I want to be able to create a patch that I can use in Ableton Live… where I can record a clip audio from my guitar and then index different locations in that recording with a MIDI note. If anyone has already done this I’d love some help on building such a patch. Thanks

Wetterberg's icon

have you checked out maxforlive.com? Browse the user library there, there are literally dozens of slicing devices, each with different pros/cons. Some really good stuff, if you dig a little.

Mike S's icon

You will first need a buffer~ object to store the audio.

This can be recorded in to with count~ and poke~

You may decide to index by divisions of tempo, or by transients. With divisions you will need to grab tempo info from live and possibly do a bit of jiggery pokery to make sure you have a way of referencing the audio relative to a grid divison (timing storing explained below).

With transients you can use an object like peakamp~ to define transients as you record. You will need to store the times at when the transients occur in either a coll or dict object. You can use the start/stop control to start and stop counting which can be in milliseconds or samples. You can use the snapshot~ object to grab the value of count~ as it's recording, or you could use an object like clocker for counting.

I'm guessing that you only want to play one part of the file at a time (monophonic sampling), so you can use one of the objects for doing that. I forget which is a cool one to use now, but I often use groove~. If you feel the project is too simple, learn gen and do the file playback in that.

So the next bit is connecting the incoming MIDI to your dict/coll object so that notes will output an index. You will need an envelope, maybe try adsr~ to start, it's likely there'll be clicks, just enjoy the clicks at this stage and then search the forum to see all possible solutions, of which there are many.

You'll probably want a waveform~ object linked to the buffer, but don't update this too fast because it's a massive CPU hog, and the bane of my existence. Send a message like buftime 250 to set the update rate to a slower speed. You could also use the waveform~ object's line message to update the playback position to give a bit of visual feedback to the user, which the user loves.

It's a pretty big project for a beginner, but all of the above objects are pretty self explanatory when they're alt clicked.