Page 1 of 1

Working with samples

Posted: Fri Jul 03, 2020 5:27 pm
by ymerejsasnak
Hello

I'm using the SamplerVoice and SamplerVoiceProgram classes to make a sampler module. My main question is, is there a built-in/easy way to change the sample start offset? I only see values for loop points. If not, is there any decent way I could achieve this without having to ditch these classes and completely code my own sampler class(es)? I guess, in the long run, that might be best given how many ideas I have for modules based around samples/sampling, but any input on this from any angle from anyone would be appreciated. :)

Also, what is the distinction between the above Sampler classes and the VoltageSound class? I haven't really explored the VoltageSound class at all yet, so maybe it should be obvious. Is the VoltageSound class a more generalized way of working with sampled audio? I guess I'm confused by the apparent overlap and lack of documentation. But I think this class maybe be the answer to my first question...and based on some methods it looks like it may simplify file loading vs SamplerVoiceProgram...hm...

On that note, we ever going to get more detailed documentation on all this stuff? ;)

JK

Re: Working with samples

Posted: Fri Jul 03, 2020 5:32 pm
by ymerejsasnak
ah...so I didn't realize...VoltageSound is a subclass of VoltageComponent...that seems to almost point me to some enlightenment except...nope...I think I'm more confused now, since I generally think of components as knobs, sliders, jacks, etc.

Re: Working with samples

Posted: Sat Jul 04, 2020 8:58 am
by JackOats
On that note, we ever going to get more detailed documentation on all this stuff? ;)
+1. :!:

Re: Working with samples

Posted: Sun Jul 05, 2020 7:29 pm
by ymerejsasnak
Just an update for anyone interested:

Figured out one way at least. When I want the sample offset to change, I recreate the SampleVoiceProgram with a new SampleVoiceProgram.SampleInfo where the ByteBuffer that I feed it is offset by the appropriate number of bytes (bytes! not samples). It seems to be working as I expect, but I have plenty of doubts about whether this method is really the best way to go about this...

I still hope to hear from SOMEONE else on this topic, but even if not I will try to post here again as I go further so there is at least a little bit of forum material about this stuff.

JK

Re: Working with samples

Posted: Mon Jul 06, 2020 9:55 am
by Captain
Not sure if this is of any help, but when I started working on my granular module (which has been WIP forever now...), I first experimented with VM’s sampler classes. I was also looking for things like being able to start sample playback at any position, etc. Pretty soon I gave up, either because the classes just couldn’t do what I wanted, or because I couldn’t understand how to do that. :D Anyway, I ended up creating my own sample playback code, which also allowed me to fully control things like interpolation, antialias filtering, playback speed and direction, etc. Maybe you are still able to use the classes VM provides, but creating your own from scratch maybe isn’t completely out of the question.