how to switch buffer~ at sample rate?

redhexagonal's icon

good morning maxers

i have tried often to find a solution for the problem of setting different bufferss to play from a single object such as play~. obviously i can use the set message, but i want to be switching at sample accuracy, as it sounds quite different when the switching is very fast.

can anyone think of a way to do this? at the moment i have resorted to compiling all my samples into a long buffer~ and playing from that one buffer~, but this tends to work best with equal length samples.

this patch shows switching sample accurately between playing 4 different buffers, but i want to do this with only one play~ object rather than 4.

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

Roman Thilenius's icon

index~.help ... ?

of course counter~ uses a lot of CPU when you start to
instantiate it in your patch.

or eventually its interesting to abuse wave~ for it.

-110

Roman Thilenius's icon

Quote: Roman Thilenius wrote on Sun, 11 March 2007 12:40
----------------------------------------------------
>
> index~.help ... ?
>
> of course counter~ uses a lot of CPU when you start to
> instantiate it in your patch.
>
>
> or eventually its interesting to abuse wave~ for it.
>
>
> -110
>
----------------------------------------------------

eh, counter~ should read count~, and count~ will also not
work from a signal.

not sure how i would feed index~ with the (signal) numbers
it requires but beside that, index~ seems the way to go.

redhexagonal's icon

i think index~ has the same problem as play~, that is the "set (buffername)" message cannot change the buffer played at sample rate, its dependent on the vector size, so it sounds sloppy.

Tyler Nitsch's icon

This would be great if we could do something like this....

I've seen in some previous discussions on this topic people referring to appending buffers together to make one big buffer with all your samples and then indexing each one. Then the issue is just finding the offset in the buffer where each sample begins/ends.

Roman Thilenius's icon

Quote: bin wrote on Sun, 11 March 2007 13:27
----------------------------------------------------
> i think index~ has the same problem as play~, that is the "set (buffername)" message cannot change the buffer played at sample rate, its dependent on the vector size, so it sounds sloppy.
>

sorry, of course i was thinking about using it with
4 different buffers.

thats the only thing i am sure of, that we have to avoid
switching buffers to find a solution for this.
(it will not be possible to send buffer names via signal!)

lets see, maybe we come up with it until the end of the week. :)

-110

_

redhexagonal's icon

ive made a basic patch which pastes individual sound files into a long list. the start points of each sample are written into the file startin at the 882000th sample (200 seconds in)

theres a simple player to test each pasted file using a midi keyboard (note 36 is the first sample)

you can drag multiple files onto the waveform object, and it will paste replace them in starting from the last sample played (via midi keyboard) or just starting from the beginning of the file if you presssed clear first

you can save the list and load it again and use the metadata to find the start points

should be useful for making sample rate multi sample players

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

redhexagonal's icon

a drawback at the moment is that you cant replace files in a previously constructed file properly, though you can append the old sounds with more samples.

redhexagonal's icon

sorry should have said you also need Fredrik Ollofsons excellent buf.Op hack which allows cut and pasting into buffers