Simple Polyphonic Sample Player

chrislos's icon

Dear all,
I hope you had a wonderful start into the new decade.

For a quite complex upcoming project I'm currently searching for a dead simple poly-sampler.
Unfortunately I tried to write it couple of attempts on my own but it's much more tricky than expected.
I played around with poly~ / and regular poly objects and voice stealing and adsr~ trigger methods.

What I want to build is a polypohnic sampler that allows me to simple add one wav sample per midi pitch value within the range of two octaves. (no re-pitching, just playing, nothing fancy) These samples should be triggered via global ADSR settings that would count for all notes. And if I trigger one sample multiple times it should be smart enough to do some "voice stealing magic" to avoid any "click-noises" when jumping back to beginning of the sample.

Right now it just gives me headache. Maybe I'm having a major design concept flaw:
How do I solve the follwing situation:
my poly~ sampleplayer has 4 voices for the same long ambient sample:

1. MIDI Note on, comes in.
---> first poly starts playing
2. MIDI Note on, come in.
---> second poly starts playing
3. MIDI Note on, come in.
---> second poly starts playing
4. MIDI Note on, come in.
--> fourth poly starts playing

all good so far.

now if I would send another MIDI ON note of course all polys would be still occupied.
What would happen is that poly steals one voice and jumps back to sample-startposition and would start with the playback again. This moment of course would be heard as a short "hickup".
In a way I need to have a more dynamic solution but I'm not sure how to solve it.

How can I avoid this?
It should pretty much work as the simplest version of the ableton sampler.

I'm sure I'm not the only one who had the problem to trigger multiple wavs hat the same time.
Maybe someone has solved this puzzle? Or has somebody a hint of decent max for live sampler that does the job? that would be the easiest way.

I attached a maxpatch describing my misery.
Maybe I'm just tired.
Maybe someone can give me a hint?

all the best
Christian

Max Patch
Copy patch and select New From Clipboard in Max.

Roman Thilenius's icon


i am not looking at the patch because i am confused enough by the words. ;)

what you basically want is that the release part of the oldest running generator is not cut off when the attack part of the next note starts, while beeing in a round robin situation with a fixed numbers of generators already.

this can only be solved by raising the number of generators (i.e. the polyphony) to 5 or 8 (or even more.)

try to add another layer of round robin to your system, where there are two samplepayers playing sample A, which are also triggered alternating. since it is already poly~, this should be really easy, no?



chrislos's icon

Hey Roman,

thanks for your response. I totally get your point of my confusing writing style.
It's too late already. Sorry. :)

I'll try to follow your instructions as soon my brain gives me some room.
I need to check again the round robin idea.

thanks so much.
Greets
Christian

chrislos's icon

Roman,
unfortunately I think I need to find another solution because adding poly layers might be a to much for my system.

In the end I'm aiming to like to have 6 instruments a 24 notes.

this would be in total 6 x 24 x (2 x 4) Polys = 1152 sfplay objects. :(

I probably have to make a restriction that just filters out notes if they occur too often or if they are still occupied. not a good solution.

anyway. I try to work it out.

Roman Thilenius's icon


you have sfplay~ objects in a sampler? that smells fishy. ;)

but yes, with 1000 voices you are probably right with not doubling their number.