I fully admit that I am a lamer when it comes to digital signals. I made this patch from one of the examples. It should just play back a loop of sample data from a table. I basically understand how phasor~ drives a quadratic interpolation lookup on tabread4~. It seems to me that samphold~ is just there to stop phasor~ from ever actually being zero by the time it gets to the tabread4~, but I don't understand why, and when I take it away the patch stops working. Also, this particular patch takes quite a while to load the sample (30 seconds?), but once the sample is loaded the first time, I can switch between samples without any delays. It is definitely not the disk being completely stupid. I checked that. I have a feeling I'm ordering the math incorrectly, but I messed around with different orderings and didn't get any results. If anyone could take a peek at this and help me understand it, I, uh, I'll give you root on pure-data.org. Or at least, the pure-data.org web application. OK that's a dumb reward. But please help anyway. Thanks.
(jfm3)
Hi.
I'm not sure what's the reason for that.
Without samphold~ (but with sig~ and phasor~ connected to *~) the patch still works fine but when you load another sample sig~ is updated *right away* and so is the left inlet of the *~. This means that if you load the patch when the phasor is at 0.5 (50% of the sample old) the "playback cursor" will jump to 50% of the new sample. Using samphold~ the left inlet of *~ is updated only when the loop starts again. In this case the current loop is completed as if the array was filled with the old sample. It means that if the unit was reading sample 1003 of the old sound, it will continue reading from sample 1004 without regard to the real size of the new sound. The sound size (used to remap the output of the phasor from the [0, 1) range to the [0, nsamples) range) will be updated by samphold~ only when the phasor value decreases. This happens only when the phasor is restaring its loop and jumps from 1 down to 0.
I don't know what's the purpose of the original patch but if the new sample is sensibly shorter than the previous one, this mean you will hear a silence. If the new sample is longer than the old one, with samphold~ you are sure you will always hear it from the beginning as quickly as possible (maybe this is the reason).
I guess most people is happy with you using root priviledges on pure-data.org as you do now.
Don't know about the delay. How large is the sample?
HTH, Maurizio Umberto Puxeddu.
Thanks very much. Your clue, that the samphold~ in the sample patch is just there to not change things until phasor~ completes a cycle, cleared the problem right up.
(jfm3)
On Tue, 2002-12-31 at 07:59, Maurizio Umberto Puxeddu wrote:
Without samphold~ (but with sig~ and phasor~ connected to *~) the patch still works fine but when you load another sample sig~ is updated *right away* and so is the left inlet of the *~. [...]