Is there a shortcut to play all samples of a sample-bank at once?

I was questioning if there is a way to play all samples in a sample bank at once?
Suppose you have a sample folder named "mysamples" and there are 4 samples in it. Then you can use the n-function to access these four so that they all play in parallel:

d1 $ n "[0,1,2,3]" # s "mysamples"

Now you could use ~dirt.soundLibrary.addBuffer to add a new sample. This sample would not be played until you add the 4 to the n-function.

What I have in mind here is that you can add as many samples as you want, e.g. through live looping to simulate an overdub mode. In this way you can add more and more recordings, only with the advantage that you can always access the individual samples again afterwards.

So maybe a function like "playall" or something like that would be useful for this?

d1 $ playall "<t f>" # s "mysamples"

The problem is that TidalCycles doesn't know how many samples are in a sample bank. But when SuperDirt is started the number of samples is also given, so I think you might be able to access it?

Maybe there is already something or someone else has already thought about it?

1 Like

With help from @julian I could solve this question on my own (see https://github.com/musikinformatik/SuperDirt/pull/209). For the sake of completeness I will post the solution here.

You need this SuperCollider function and add it as a module to SuperDirt:

(
~playAll = 0;

~dirt.addModule('playAll', {
	if (~playAll != 0, {
		~dirt.soundLibrary.buffers[~s].size.do({
			arg item;
			var event = ();

			event.putAll((\type: \dirt, \dirt: ~dirt ),currentEnvironment);
			event.removeAt(\playAll);

			if (item != ~n, {
				event[\n] = item;
				event.play;
			});
		});
	})

}, {~playAll.notNil});

)

On the Tidal side you need this (because the pB function is not implemented in Tidal yet, see https://github.com/tidalcycles/Tidal/pull/727)

pB :: String -> Pattern Bool -> ControlPattern
pB name = fmap (Map.singleton name . (flip VB) Nothing)

And you need this:

playAll = pB "playAll"

Now you can use the playAll function in Tidal like

d1 $ playAll "t" # s "[mysamples1, mysamples2, mysamples3]"

You can find a "real world" example for this here: https://github.com/thgrund/tidal-looper/tree/master/overdub -> some kind of overdubbing with live-looping in TidalCycles.

1 Like