Audio freezes when sample kits are swapped

Hey, I’m working with the following chain in Orac 2:

Audio In → Sampler → Granular Effect

As soon as I switch a kit inside my sampler, audio that’s currently running (and doesn’t rely on the samples) freezes until the new kit is fully loaded. This can take up to a few seconds depending on the kit size.

This affects the audio in signal as well as “re-sampled” grains that are detached from the actual samples and run inside the separate effect patch.

Is there a way to load kits inside the sampler without affecting audio in and effect patch signal?

Attached is a picture of the patches that manage kit loading inside the sampler.

Thank you!
Philipp

Unfortunately I don’t believe there is anything you can do about that as far as I know :frowning_face: The sound you’re hearing is the sample loading up into memory and because Pure Data is a single thread process, it freezes all audio until the table gets resized and the data gets put into it. It could probably be reduced if you use smaller samples however

1 Like

I see. This info already helps changing the direction for a solution, thanks. :slight_smile:

I’m wondering if I could just load all samples from all kits before the performance starts (and obviously wait a while for it to be ready).
And therefore change the code from actually loading the right samples to just “pointing” at them.

Do you know if Organelle M is able to load ~1GB in form of ~100 wav samples without problems like lagging, drop-outs etc once it’s all loaded?

I do believe that could work! There MAY be the need to code in some kind of ‘reload’ function into whatever sampler you’re using because I don’t know if your samples will reload when opening presets. I don’t know if that’s really necessary but if you run into problems, its worth considering but that is definitely the direction I would go in

1 Like

Great, that’s good to know! I’ll give it a shot. :slight_smile:

It freezes because it’s pulling samples from the sd-card storage (which is too slow for the task), but the Organelle M has 1GB RAM so you should be able to load the desired samples on memory when the patch loads the first time.

Not sure about how much memory you can fill before compromising performance, I haven’t messed with samples too much yet, but I might have to start! :slightly_smiling_face:

1 Like

A quick update on the situation:

All samples now load from one large kit once the sampler is opened. This takes up to 2 minutes but works totally fine afterwards.
An additional control lets me assign the right samples to buttons in groups of 12 (one octave).
I also added a kit switch control that changes between THE kit and a dummy kit so that I can “re-load” the samples at any time inside the patch if needed.

Thanks again for your help! :slight_smile:

1 Like

Awesome! Glad to hear you got it to work! Are you just using Sampler24?

Oh, totally missed your reply…

I’m using “MIDI Out” on Orac’s A1 to trigger external gear with some buttons, then a modified version of “Sampler24” on A2 for loops and one-shots and a modified version of “clds” on A3 which lets me freeze and mangle the sample material and audio-in with some of the buttons.

I really want to share the resulting patches with the community at some point, once it is working properly and cleaned up.

1 Like

Hi @philipp ,
do you mind sharing how you managed to preload samples on RAM?

I’m working on a looper which require to load loops on memory (otherwise I get the same issue you had), so having your input would put me on the right track :pray:

Also, what limitation did you find in regard to sample length/size?

Thanks!

@Audivit Are you reading and writing from the same array? I’ve been working on a looper as well and ran into the same problem of glitching for a moment after reading/writing to memory but have yet to figure out a way to get past it :confused:

One option that you could maybe do is have one array for reading and one for writing but I’m not entirely sure if that would do anything. There may also be an element of adding delay to ensure the array can open and close correctly. One other thing that might be of note is the fact that table writing and reading starts in intervals of 64 samples. If there are any developments on this, I will surely be checking this thread out some more :slight_smile:

1 Like

Sure! Attached is the latest version of the sampler. Definitely a bit messy at this point since it’s WIP, but it currently works for me.

I’m working with two kits inside this modified sampler24 patch. It loads with Kit 2 by default which is just a small dummy Kit to keep the loading time short for some easy testing. I exposed the Kit selector on the last page so that I can switch over to the “real” Kit 1 easily which then takes another 20 seconds or so to load roughly 300MB of 16bit/44.1 Stereo-WAV-Files into RAM, ~100 samples with the longest sample being ~20s long.

Once this is done I can easily switch between the sample sets in groups of 12 using another parameter and play them using the first octave on the keys. This also works while samples are played back. A new sample only starts playback if the key is triggered again. This way samples of different sets can be combined.

The keys of the second octave are mainly used to trigger MIDI-Out and Freeze-functionality in the Grain-Effect-Patch that sits afterwards in the chain. This way I can even turn off all the samples and still hear and manipulate the frozen GrainFX signal grabbed from the Sampler or AudioIn while staying inside the Sampler patch to e.g. pick the next set of samples.

220821 massampler.zip (28.3 KB)

3 Likes

Thanks a lot @philipp and @T8R for your precious help! :pray:

Meanwhile I’ve been messing around with Oracloops and would love to try this solution with it as I’m using it more and more, and having loops preloaded on memory would be a whole new level of fun!

2 Likes