<div dir="ltr">yeah, I was gonna say something similar<div><br></div><div>the problem is more likely with phasor~ whose period won't fit harmonically, this means there'll always be an offset in the next period, hence, all periods will be different and have some offset. Like cyrille pointed, you need to have a frequency that matches a number of samples so it gets repeated always the same.</div><div><br></div><div>What you actually need is not phasor~ but a ramp generator that repeats itself at a fixed number of samples, which corresponds to the frequency you want. Or a ramp generator that gets reset with sample accuracy.</div><div><br></div><div>See [else/accum~] and [else/ramp~]<br></div><div><br></div><div>you could try a hacky way to do something like that with [fexpr~] in vanilla</div><div><br></div><div>anyway, I'm not sure I actually follow much of your email, but I'm with cyrille here, cause wrap~ will just give you the modulo and it's not likely that it is giving you the offsets</div><div><br></div><div>cheers</div></div><div class="gmail_extra"><br><div class="gmail_quote">2018-04-26 17:00 GMT-03:00 cyrille henry <span dir="ltr"><<a href="mailto:ch@chnry.net" target="_blank">ch@chnry.net</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hello,<br>
I don't think your probem is with wrap~.<br>
<br>
if you create a phasor at 25x120 = 3000Hz, using a 44100KHz samplerate, you will notice that all ramp have different amplitude.<br>
This is because a ramp have 4100/3000 sample = 14.7 point for each ramp.<br>
if you switch to 48KHz, you will have 16 sample per ramp, and all ramp will have the same amplitude.<br>
This also create phase isue.<br>
<br>
So, I gueess you should use a fps that is compatible with your samplerate.<br>
<br>
cheers<span class="HOEnZb"><font color="#888888"><br>
c</font></span><span class="im HOEnZb"><br>
<br>
<br>
<br>
<br>
<br>
Le 26/04/2018 à 21:23, Derek Holzer a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Dear Pd friends,<br>
<br>
can you help me to understand [wrap~] better? My purpose is to create a "video raster" (using audio signals at a high sample rate) of X and Y values to read luma information from [pix_data].<br>
<br>
To do this, I have one [phasor~] creating the vertical ramp, at 25 Hz (= 25 frames per second).<br>
<br>
Then I require another series of ramps from 0 to 1 for the horizontal lines. If I want 120 lines per frame, I do it like this:<br>
<br>
[phasor~ 25]<br>
|<br>
[*~ 120]<br>
|<br>
[wrap~]<br>
<br>
This gives me 120 ramps for every one cycle of [phasor~]. So far so good.<br>
<br>
However, the ramps I get are not equal in amplitude, there are tiny variations which cause distortions in the raster, and which I can see when I plot the ramps to a array with [tabwrite~], and which I can see as a jagged edge if I plot my raster out on an XY oscilloscope or similar.<br>
<br>
Also, the ramps have some phase issues. 25 frames with 120 lines per frame works just fine, but as I adjust the frame rate or the number of lines per frame, the image data which I get from [pix_data] seems to "rotate" out of the frame and wrap around to the other side. Only multiples of 25/120 give me image date which is centered in the frame of the video or image being analyzed by [pix_data].<br>
<br>
I would be happy to make a video of this if you like, but I wonder if someone with better DSP knowledge than me might have some suggestions.<br>
<br>
You can see the patch in question here:<br>
<br>
<a href="https://github.com/macumbista/vectorsynthesis/blob/master/V-scanprocessor-help.pd" rel="noreferrer" target="_blank">https://github.com/macumbista/<wbr>vectorsynthesis/blob/master/V-<wbr>scanprocessor-help.pd</a><br>
<br>
(Requires checking out entire Vector Synthesis library. Also requires PD >= 0.47 and Gem if you want all of it to work. Open the [V-scanprocessor] object to see the [phasor~] and [wrap~] configuration.)<br>
<br>
Andy Farnell suggested that the amplitude differences in the ramps may be a cumulative 32 bit precision error, but that would not explain the phase issue. I also tried using sample-rate [metro] and [line~] objects to create the horizontal lines but this was even less precise.<br>
<br>
Thank you for your kind attention!<br>
Derek<br>
</blockquote>
<br></span><div class="HOEnZb"><div class="h5">
______________________________<wbr>_________________<br>
<a href="mailto:Pd-list@lists.iem.at" target="_blank">Pd-list@lists.iem.at</a> mailing list<br>
UNSUBSCRIBE and account-management -> <a href="https://lists.puredata.info/listinfo/pd-list" rel="noreferrer" target="_blank">https://lists.puredata.info/li<wbr>stinfo/pd-list</a><br>
</div></div></blockquote></div><br></div>