Sampler Tuning

Nano59's icon

Hi,

I've been getting back into max msp again and I have a little query about tuning a sampler. 

So, I have a patch which you can load a sample into and then play a midi keyboard to pitch shift the sample and play a tune or whatever.  Basically it's the same as the groove sustain loop help file in terms of transposition of the sample played.  

The problem I find is that pressing middle C (I think) on the midi keyboard just plays the sample back at playback rate 1.  Therefore if the sample is not tuned to C then all the keys pressed on the midi keyboard aren't tuned right.  So my question is: how can I make sure that, even if the sample is not tuned to C, the key pressed on the midi keyboard plays the sample at the correct pitch for the note pressed?

Wetterberg's icon

Hi,

then you need to give your patch some way of knowing what pitch your sample is playing at. Best way (by far) is to do this manually ahead of time and pitch things around.

A fun way of doing it is in real time, though. Use an object like [retune~] to detech the pitch of the sample on load or whatever, and then adjust to fit what you're playing.

This has the added benefit of allowing for your to sample live and arbitrary stuff and make it work a bit better.

Christopher Dobrian's icon

A standard approach is to keep track of the base pitch of each original sample (in a data structure), and use that information to transpose the playback rate accordingly. An example is given in
MSP MIDI Tutorial 3: MIDI Sampler.

Nano59's icon

thank you for the help guys. I've been playing around with it this evening and found the main issue is finding the pitch of the sample with retune. It doesnt seem to respond well to any of the samples I load including a sample of a synth which is just a C note.

I set up another groove object within my Poly~ to play the sample at 1 so that it plays normally and tried to use retune to find the pitch. I then used the section from the midi sampler tutorial which changes the playback rate of the groove according to the pitch of the sample. But yeh, the main issue is getting retune to actually output any meaningful data on the base frequency/note of the samples I am using.