[PD] a full-featured sampleplayer

Atte André Jensen atte.jensen at gmail.com
Thu Aug 7 17:39:48 CEST 2008


I've build a sample player abstraction, and now I just thought of one 
more feature it needs, and that makes me think I need to redo it again. 
So here goes:

I need a sample player "motor" that is flexible enough to handle any 
(most) things I throw at it, at least:

* Handles stereo/mono, various sample rates and bit depths transparently.
* Allow changing of playback rate during playback
* Both lopping and non-looping mode
* Optional crossfade looping with configurable crossfade length.

First: Is there such a thing outthere already (before I redo it all again)?

Second: If not, a thing that I can't figure out is the cross-fade part. 
I thought about having two phasors, and every SAMPLELENGTH-XFADETIME 
restarting the idle one, and fading it up in XFADETIME while fading the 
running one down. Problem is that if the playback rate has changed since 
last cycle the switch will not be at the end of the running sample. 
Instead I guess the way to go is to look at the output of phasor~ and 
from it's output determine when it's time to start the fade, which 
should occur at (SAMPLELENGTH-XFADETIME)/SAMPLELENGTH. How can I inspect 
an audiosignal and get bang'ed when it's it reaches some value? I looked 
at [<~], but it seems to output audio, so I guess I can't use that. Or 
am I totally off in my approach?

Any input appreciated...

peace, love & harmony

http://atte.dk       | http://myspace.com/attejensen
http://anagrammer.dk | http://modlys.dk

More information about the Pd-list mailing list