<?xml version="1.0" encoding="UTF-8"?>
	<rss version="2.0"
		xmlns:content="http://purl.org/rss/1.0/modules/content/"
		xmlns:wfw="http://wellformedweb.org/CommentAPI/"
		xmlns:dc="http://purl.org/dc/elements/1.1/"
		xmlns:atom="http://www.w3.org/2005/Atom"

			>

	<channel>
		<title>Cycling 74  &#187;  Topic: circular buffers and wrap-around reading</title>
		<atom:link href="http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/feed" rel="self" type="application/rss+xml" />
		<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/feed</link>
		<description></description>
		<pubDate>Wed, 19 Jun 2013 03:18:16 +0000</pubDate>
		<generator>http://bbpress.org/?v=2.2.4</generator>
		<language></language>

		
														
					
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-24556</guid>
					<title><![CDATA[circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-24556</link>
					<pubDate>Wed, 22 Feb 2006 15:44:15 +0000</pubDate>
					<dc:creator>pmt</dc:creator>

					<description>
						<![CDATA[
						<p>Hi,</p>
<p>I&#8217;m working with the buffer~ and wave~ objects to try to create a <br />
circular/continuous buffer. i.e., I have a moving &#8216;window&#8217; of sound that <br />
can be any length and can read from it at any point. I&#8217;m most of the way <br />
there, but there is one issue that doesn&#8217;t make the window smooth. As <br />
I&#8217;m reading individual samples from the buffer (no need for looping), I <br />
am using line~ to drive wave~. However, unlike phasor~ which will wrap <br />
around from the end of the buffer to the beginning, line~ doesn&#8217;t appear <br />
to do that. For example, if I have a 5000 ms. buffer, and I specify that <br />
line~ go from 4000 to 1000, it is going to go backwards and give me a 3 <br />
sec. reverse sample as opposed to wrapping around to give me a 2 sec. <br />
forward-played sample. Is there any way to get line~ to wrap around or <br />
to always move forward through a buffer? Many thanks.</p>
<p>Best,</p>
<p>Peter</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71236</guid>
					<title><![CDATA[Re: circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71236</link>
					<pubDate>Wed, 22 Feb 2006 18:26:57 +0000</pubDate>
					<dc:creator>Peter McCulloch</dc:creator>

					<description>
						<![CDATA[
						<p>pong~ is what you want for wrapping audio signals into a given range.   <br />
It has two modes:   pong and asteroids,  (behaves like the ball in the  <br />
old Atari games)  but it prefers to refer to them as mode 0 and mode 1.</p>
<p>However, your problem would be better solved by the abstraction at the  <br />
bottom.  All it will do is sort the two values.  (if you&#8217;re always  <br />
going from the minimum to the maximum time, you&#8217;ll always be reading  <br />
forward.</p>
<p>Peter McCulloch</p>
<p>Also, for people craving control-rate pong action, here&#8217;s PM.Pong:</p>
<p>max v2;<br />
#N vpatcher 57 44 832 342;<br />
#P origin 9 -62;<br />
#P inlet 491 113 15 0;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P window linecount 1;<br />
#P newex 508 113 128 196617 loadmess $3;<br />
#N vpatcher 20 74 620 474;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P window linecount 1;<br />
#P comment 235 151 128 196617 <a href="mailto:peter.mculloch@gmail.com">peter.mculloch@gmail.com</a>;<br />
#P comment 199 68 215 196617 Sorts two numbers , so that outlet 1 < <br />
outlet 2;<br />
#P window setfont &#8220;Arial Black&#8221; 18.;<br />
#P comment 199 32 167 791478290 PM.MinMax;<br />
#N comlet maximum;<br />
#P outlet 111 147 15 0;<br />
#N comlet minimum;<br />
#P outlet 39 148 15 0;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P comment 91 39 24 196617 V2;<br />
#N comlet Max;<br />
#P inlet 94 57 15 0;<br />
#N comlet Min;<br />
#P inlet 39 57 15 0;<br />
#P newex 39 87 65 196617 bondo 2 5;<br />
#P newex 111 125 65 196617 maximum 0.;<br />
#P newex 39 125 62 196617 minimum 0.;<br />
#P comment 37 39 24 196617 V1;<br />
#P connect 4 0 3 0;<br />
#P connect 3 0 1 0;<br />
#P connect 1 0 7 0;<br />
#P connect 3 1 1 1;<br />
#P connect 5 0 3 1;<br />
#P connect 3 0 2 0;<br />
#P connect 2 0 8 0;<br />
#P connect 3 1 2 1;<br />
#P pop;<br />
#P newobj 259 147 242 196617 p MinMax;<br />
#P inlet 259 113 15 0;<br />
#P outlet 27 235 15 0;<br />
#N vpatcher 20 74 601 258;<br />
#P outlet 32 133 15 0;<br />
#P inlet 32 49 15 0;<br />
#P inlet 406 47 15 0;<br />
#P inlet 219 47 15 0;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P hidden newex 428 47 113 196617 loadmess scalarmode 1;<br />
#P newex 32 81 385 196617 vexpr  <br />
(((((($f1-$f2)/($f3-$f2))-int(($f1-$f2)/($f3-$f2))))*($f3- <br />
 $f2)+$f2)*(($f1-$f2)>=0))+(((((($f1-$f2)/($f3-$f2))-int(($f1 -$f2)/($f3- <br />
$f2))))*($f3-$f2)+$f3)*(($f1-$f2)&lt;0));<br />
#P hidden fasten 1 0 0 0 433 76 37 76;<br />
#P connect 4 0 0 0;<br />
#P connect 0 0 5 0;<br />
#P connect 2 0 0 1;<br />
#P connect 3 0 0 2;<br />
#P pop;<br />
#P newobj 52 191 475 196617 p Wrap;<br />
#P newex 136 54 27 196617 % 2;<br />
#P newex 136 31 65 196617 loadmess $1;<br />
#P newex 113 86 27 196617 + 1;<br />
#N vpatcher 20 74 620 474;<br />
#P outlet 32 191 15 0;<br />
#P inlet 32 49 15 0;<br />
#P inlet 406 47 15 0;<br />
#P inlet 219 47 15 0;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P hidden newex 466 46 113 196617 loadmess scalarmode 1;<br />
#P newex 32 169 75 196617 vexpr $f1+$f2;<br />
#P newex 97 118 383 196617 vexpr  <br />
[(((abs(int(($f2-$f1)/($f3-$f2)))&lt;0.)+(abs(int(($f2-$f1)/($f3- <br />
 $f2)))%2)%2)==1)]*[(-1.*abs(($f1-$f2)-(int(($f1-$f2)/($f3-$f 2)))*($f3- <br />
$f2)))+$f3];<br />
#P newex 32 81 385 196617 vexpr  <br />
[(((abs(int(($f2-$f1)/($f3-$f2)))&lt;0.)+(abs(int(($f2-$f1)/($f3- <br />
 $f2)))%2)%2)==0)*(abs(($f1-$f2)-(int(($f1-$f2)/($f3-$f2)))*( $f3- <br />
$f2))+$f2)];<br />
#P hidden fasten 3 0 0 0 471 76 37 76;<br />
#P connect 6 0 0 0;<br />
#P hidden fasten 3 0 2 0 471 163 37 163;<br />
#P connect 0 0 2 0;<br />
#P connect 2 0 7 0;<br />
#P hidden fasten 3 0 1 0 471 113 102 113;<br />
#P connect 6 0 1 0;<br />
#P connect 1 0 2 1;<br />
#P connect 4 0 0 1;<br />
#P connect 4 0 1 1;<br />
#P connect 5 0 0 2;<br />
#P connect 5 0 1 2;<br />
#P pop;<br />
#P newobj 27 171 475 196617 p Fold;<br />
#P newex 27 117 35 196617 gate 2;<br />
#P inlet 113 31 15 0;<br />
#P inlet 52 31 15 0;<br />
#P newex 276 113 128 196617 loadmess $2;<br />
#P fasten 5 0 3 0 118 109 32 109;<br />
#P connect 3 0 4 0;<br />
#P connect 8 0 9 0;<br />
#P connect 4 0 9 0;<br />
#P connect 1 0 3 1;<br />
#P connect 3 1 8 0;<br />
#P fasten 7 0 5 0 141 78 118 78;<br />
#P connect 2 0 5 0;<br />
#P connect 6 0 7 0;<br />
#P connect 0 0 11 0;<br />
#P connect 10 0 11 0;<br />
#P connect 11 0 4 1;<br />
#P connect 11 0 8 1;<br />
#P connect 12 0 11 1;<br />
#P connect 13 0 11 1;<br />
#P connect 11 1 4 2;<br />
#P connect 11 1 8 2;<br />
#P pop;</p>
<p>Sorting abstraction:</p>
<p>max v2;<br />
#N vpatcher 10 59 610 459;<br />
#P inlet 127 42 15 0;<br />
#P inlet 61 42 15 0;<br />
#P outlet 87 142 15 0;<br />
#P outlet 61 141 15 0;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P window linecount 1;<br />
#P newex 61 66 76 196617 bondo 2;<br />
#P newex 87 115 65 196617 maximum 0.;<br />
#P newex 61 94 62 196617 minimum 0.;<br />
#P connect 5 0 2 0;<br />
#P connect 2 0 0 0;<br />
#P connect 0 0 3 0;<br />
#P connect 2 0 1 0;<br />
#P connect 1 0 4 0;<br />
#P connect 2 1 0 1;<br />
#P connect 6 0 2 1;<br />
#P connect 2 1 1 1;<br />
#P pop;</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71237</guid>
					<title><![CDATA[Re: circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71237</link>
					<pubDate>Wed, 22 Feb 2006 18:42:18 +0000</pubDate>
					<dc:creator>Mark Pauley</dc:creator>

					<description>
						<![CDATA[
						<p>I would recommend an abstraction: mono_line~</p>
<p>You need to know the direction (monotonacity) and the maximum /  <br />
minimum clip values.  You could use pong~ as described before, and if  <br />
the destination is in the wrong direction, add the difference to the  <br />
maximum value (negate all of this for monotonically decreasing line).   <br />
You&#8217;ll in effect be unwrapping the values and then using pong~ to clip  <br />
your line for you.</p>
<p>
_Mark</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71238</guid>
					<title><![CDATA[Re: circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71238</link>
					<pubDate>Wed, 22 Feb 2006 20:09:49 +0000</pubDate>
					<dc:creator>pmt</dc:creator>

					<description>
						<![CDATA[
						<p>great! thanks, i&#8217;ll check those all out. i assume you can read forward, <br />
backward, and at different speeds? so pong~ in &#8216;asteroids mode&#8217; should <br />
theoretically give me a smooth two second sample if, in a 5000 ms <br />
buffer, i read forward from 4000ms to 1000ms (and sound is continuous <br />
through the wrap-around)? thanks again!</p>
<p>best,</p>
<p>peter</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71239</guid>
					<title><![CDATA[Re: circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71239</link>
					<pubDate>Wed, 22 Feb 2006 20:44:02 +0000</pubDate>
					<dc:creator>Peter McCulloch</dc:creator>

					<description>
						<![CDATA[
						<p>Not exactly.  Pong~ has no sense of direction.  It only operates on a <br />
signal if it is outside the specified boundaries.  However, if you did <br />
pong~ 1 0 5000 and tried to read from 4000 to 6000 with line~, you <br />
would do 4000->5000 then 0-1000.  (it would wrap)  If you feed line~ <br />
5000 to 3000, you would still get that.  (so it would play backwards in <br />
that circumstance)</p>
<p>You might think about it as an starting offset + width problem rather <br />
than a start and end problem.  (the good news is that the math is easy, <br />
and makes transposition trivial to implement)</p>
<p>Peter</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71240</guid>
					<title><![CDATA[Re: circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71240</link>
					<pubDate>Wed, 22 Feb 2006 21:25:04 +0000</pubDate>
					<dc:creator>Peter Castine</dc:creator>

					<description>
						<![CDATA[
						<p>On around Feb 22, 2006, at 19:26, Peter McCulloch said something like:<br />
> pong~ is what you want for wrapping audio signals into a given range.  <br />
> It has two modes:   pong and asteroids,</p>
<p>Yet another tool for wrapping audio signals: lp.scampf, which offers <br />
three modes: clip, wrap, and reflect, as well as linear and nonlinear, <br />
symmetrical and asymmetrical mapping of input to output values.</p>
<p>If I can find some time I&#8217;ll see if I can whip up a demo patch, but <br />
this may not happen all too soon&#8230;</p>
<p>> but it prefers to refer to them as mode 0 and mode 1.</p>
<p>lp.scampf prefers to refer to its modes as clip, wrap, and reflect <br />
rather than &#8220;pong&#8221;. I&#8217;ve spent too much time among the Brits to want to <br />
pong.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8211;    <a href="http://www.bek.no/~pcastine/Litter/" rel="nofollow">http://www.bek.no/~pcastine/Litter/</a>    &#8212;&#8212;&#8212;&#8212;&#8211;<br />
Peter Castine    |                             ^<br />
                  |         Litter Power &#038; Litter Bundle for Jitter<br />
<a href="mailto:pcastine@gmx.net">pcastine@gmx.net</a> |<br />
<a href="mailto:pcastine@bek.no">pcastine@bek.no</a>  | iCE:  Sequencing, Recording, and Interface Building<br />
<a href="mailto:4-15@kagi.com">4-15@kagi.com</a>    |       for Max/MSP<br />
                  |                                      Extremely cool<br />
                  |      <a href="http://www.dspaudio.com" rel="nofollow">http://www.dspaudio.com</a><br />
                  |      <a href="http://www.dspaudio.com/software/software.html" rel="nofollow">http://www.dspaudio.com/software/software.html</a></p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71241</guid>
					<title><![CDATA[Re: circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71241</link>
					<pubDate>Sat, 25 Feb 2006 16:43:05 +0000</pubDate>
					<dc:creator>dmichael@ispwest.com</dc:creator>

					<description>
						<![CDATA[
						<p>
> On around Feb 22, 2006, at 19:26, Peter McCulloch said something like:<br />
> > pong~ is what you want for wrapping audio signals into a given range.  <br />
> > It has two modes:   pong and asteroids,</p>
<p>
> Yet another tool for wrapping audio signals: lp.scampf, which offers <br />
> three modes: clip, wrap, and reflect, as well as linear and nonlinear, <br />
> symmetrical and asymmetrical mapping of input to output values.<br />
> <br />
> If I can find some time I&#8217;ll see if I can whip up a demo patch, but <br />
> this may not happen all too soon&#8230;</p>
<p>Hello,<br />
I&#8217;m interested in the circular buffer/wrapping concept as well and was wondering if there was an example patch out there.  I&#8217;m not certain what to do with the pm.pong abstract.  Is there a help/demo patch of what exactly that abstract does?<br />
  Thanks,<br />
 Doug Michael</p>
						]]>
					</description>

					
					
				</item>

			
				<item>
					<guid>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71242</guid>
					<title><![CDATA[Re: circular buffers and wrap-around reading]]></title>
					<link>http://cycling74.com/forums/topic/circular-buffers-and-wrap-around-reading/#post-71242</link>
					<pubDate>Sun, 26 Feb 2006 03:05:25 +0000</pubDate>
					<dc:creator>Peter McCulloch</dc:creator>

					<description>
						<![CDATA[
						<p>This should hopefully clarify things.</p>
<p>thanks,</p>
<p>Peter McCulloch</p>
<p>> Hello,<br />
> I&#8217;m interested in the circular buffer/wrapping concept as well and was <br />
> wondering if there was an example patch out there.  I&#8217;m not certain <br />
> what to do with the pm.pong abstract.  Is there a help/demo patch of <br />
> what exactly that abstract does?<br />
>   Thanks,<br />
>  Doug Michael<br />
></p>
<p>
max v2;<br />
#N vpatcher 10 59 527 548;<br />
#P window setfont &#8220;Sans Serif&#8221; 9.;<br />
#P window linecount 1;<br />
#P comment 339 449 134 196617 <a href="mailto:peter.mcculloch@gmail.com">peter.mcculloch@gmail.com</a>;<br />
#P comment 203 160 53 196617 high value;<br />
#P comment 180 139 53 196617 low value;<br />
#P comment 370 158 53 196617 high value;<br />
#P newex 79 39 48 196617 loadbang;<br />
#P comment 54 413 30 196617 &#8211; 10;<br />
#P flonum 331 157 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P flonum 305 137 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P flonum 253 211 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P user multiSlider 253 239 160 181 -10. 10. 1 3961 15 1 0 2 0 0 0;<br />
#M frgb 0 0 0;<br />
#M brgb 255 255 255;<br />
#M rgb2 127 127 127;<br />
#M rgb3 0 0 0;<br />
#M rgb4 37 52 91;<br />
#M rgb5 74 105 182;<br />
#M rgb6 112 158 18;<br />
#M rgb7 149 211 110;<br />
#M rgb8 187 9 201;<br />
#M rgb9 224 62 37;<br />
#M rgb10 7 114 128;<br />
#P newex 253 179 89 196617 Pm.Pong 1 -1. 4.;<br />
#P flonum 157 157 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P flonum 131 137 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P message 79 64 74 196617 0 , 100 10000;<br />
#P newex 79 90 53 196617 line 0. 20;<br />
#P flonum 79 211 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P user multiSlider 79 239 160 181 -10. 10. 1 3961 15 1 0 2 0 0 0;<br />
#M frgb 0 0 0;<br />
#M brgb 255 255 255;<br />
#M rgb2 127 127 127;<br />
#M rgb3 0 0 0;<br />
#M rgb4 37 52 91;<br />
#M rgb5 74 105 182;<br />
#M rgb6 112 158 18;<br />
#M rgb7 149 211 110;<br />
#M rgb8 187 9 201;<br />
#M rgb9 224 62 37;<br />
#M rgb10 7 114 128;<br />
#P flonum 79 115 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;<br />
#P newex 79 179 89 196617 Pm.Pong 0 -1. 4.;<br />
#P comment 54 239 20 196617 10;<br />
#P comment 347 137 53 196617 low value;<br />
#P window linecount 2;<br />
#P comment 191 54 222 196617 PM.Pong wraps numbers into a specified <br />
range. Works like pong~ , but on control rate stuff.;<br />
#P connect 17 0 8 0;<br />
#P connect 7 1 8 0;<br />
#P connect 8 0 7 0;<br />
#P connect 7 0 4 0;<br />
#P connect 4 0 3 0;<br />
#P connect 3 0 6 0;<br />
#P connect 6 0 5 0;<br />
#P connect 9 0 3 2;<br />
#P connect 10 0 3 3;<br />
#P fasten 4 0 11 0 84 134 258 134;<br />
#P connect 11 0 13 0;<br />
#P connect 13 0 12 0;<br />
#P connect 14 0 11 2;<br />
#P connect 15 0 11 3;<br />
#P pop;</p>
						]]>
					</description>

					
					
				</item>

					
		
	</channel>
	</rss>

