An easy way to unify units of measurement for sample/file players

Depending on what sound function you use parameters can be in either of the following:

  • seconds (eg. buffer size, setOffset, setLoopRange)
  • frames (eg. getSubsample, setPlayRange)
  • bytes are also mentioned but not sure if used

It would be great if there was a way of unifying these. Utility functions to obtain the correct units or conversion from the sample itself.

I have a feeling these could be some simple functions with the right understanding.

If I'm missing something, please enlighten me!

Also I note that setLoopRange takes seconds for fileplayer but setPlayRange uses frame offsets for sampleplayer.


I'd personally like to see (audio) samples, as it's the underlying unit behind digital audio.