Creating a lightweight custom sample player (not using Sampler or AudioLoopPlayer)
-
Hello, I'm a sound designer / programmer for video games dipping my toes into HISE for the first time - very exciting! I have a custom sampler concept for sound design purposes (not music) that I want to build and I don't think Sampler or AudioLoopPlayer are suitable for the sample playback part of it.
I need to load a large number of samples (may be in the 100s) and select them in a random order, controlling the start position, duration, fades etc of each triggered sample according to user controlled inputs. A bit like a granular sample player but each grain will come from a similar position in a different sample, rather than a different position in the same sample.
I will trigger with MIDI but note pitch and velocity are not relevant, so this isn't a traditional sample mapping situation - I just need a big array of source samples (>128 so spreading them across keys isn't a viable workaround) and a simple way to play each one. Grab sample from the array, play it. Grab next sample, play it. Etc. Samples will overlap, up to a maximum voice limit.
Any suggestions / examples on how to do this would be much appreciated!
-
@mistercw I'd use the sampler. You have 3 dimensions for mapping - pitch, velocity, RR group. There's also the advanced mapping editor but I don't think it's ready for real projects yet.
You can use scripting to select the sample you want to trigger based on your requirements.
In order to be able to change the start position in real-time I think you'd need to load the entire sample into RAM, so you'll want to set this in the sampler's pre-load settings.
-
@David-Healey many thanks for your quick response - so essentially treat the note / vel / RR group assignments as one big sample container? Makes sense, but one more question...
is it possible to hide that from the user, giving them a way to add their samples without using the sample mapping interface?
E.g. if I have a folder full of samples Sample_001 to Sample_250 or whatever, I would not ideally have to perform any action myself to assign them to notes / velocities etc as that is not relevant to the intended usage. Ideally I would do something like click on an Import Samples button, browse to my folder, and import the samples, and have the plugin handle the mapping with no input from me. (Or drag and drop, without having to batch them into 127 or less and then edit velocity ranges etc). The intent would always be to map them from the first available slot e.g. note 0, velocity 1 upwards with no gaps.
-
@mistercw said in Creating a lightweight custom sample player (not using Sampler or AudioLoopPlayer):
is it possible to hide that from the user, giving them a way to add their samples without using the sample mapping interface?
Yes you can tuck it behind whatever interface you choose. All of this is custom behaviour though that you'll have to script, there is no built-in handling for it.
I recommend starting simple with 10 or so samples, then expand out once you have it working.
-
@David-Healey thanks!