circular buffers and wrap-around reading
Hi,
I'm working with the buffer~ and wave~ objects to try to create a
circular/continuous buffer. i.e., I have a moving 'window' of sound that
can be any length and can read from it at any point. I'm most of the way
there, but there is one issue that doesn't make the window smooth. As
I'm reading individual samples from the buffer (no need for looping), I
am using line~ to drive wave~. However, unlike phasor~ which will wrap
around from the end of the buffer to the beginning, line~ doesn't appear
to do that. For example, if I have a 5000 ms. buffer, and I specify that
line~ go from 4000 to 1000, it is going to go backwards and give me a 3
sec. reverse sample as opposed to wrapping around to give me a 2 sec.
forward-played sample. Is there any way to get line~ to wrap around or
to always move forward through a buffer? Many thanks.
Best,
Peter
pong~ is what you want for wrapping audio signals into a given range.
It has two modes: pong and asteroids, (behaves like the ball in the
old Atari games) but it prefers to refer to them as mode 0 and mode 1.
However, your problem would be better solved by the abstraction at the
bottom. All it will do is sort the two values. (if you're always
going from the minimum to the maximum time, you'll always be reading
forward.
Peter McCulloch
Also, for people craving control-rate pong action, here's PM.Pong:
Sorting abstraction:
I would recommend an abstraction: mono_line~
You need to know the direction (monotonacity) and the maximum /
minimum clip values. You could use pong~ as described before, and if
the destination is in the wrong direction, add the difference to the
maximum value (negate all of this for monotonically decreasing line).
You'll in effect be unwrapping the values and then using pong~ to clip
your line for you.
_Mark
great! thanks, i'll check those all out. i assume you can read forward,
backward, and at different speeds? so pong~ in 'asteroids mode' should
theoretically give me a smooth two second sample if, in a 5000 ms
buffer, i read forward from 4000ms to 1000ms (and sound is continuous
through the wrap-around)? thanks again!
best,
peter
Not exactly. Pong~ has no sense of direction. It only operates on a
signal if it is outside the specified boundaries. However, if you did
pong~ 1 0 5000 and tried to read from 4000 to 6000 with line~, you
would do 4000->5000 then 0-1000. (it would wrap) If you feed line~
5000 to 3000, you would still get that. (so it would play backwards in
that circumstance)
You might think about it as an starting offset + width problem rather
than a start and end problem. (the good news is that the math is easy,
and makes transposition trivial to implement)
Peter
On around Feb 22, 2006, at 19:26, Peter McCulloch said something like:
> pong~ is what you want for wrapping audio signals into a given range.
> It has two modes: pong and asteroids,
Yet another tool for wrapping audio signals: lp.scampf, which offers
three modes: clip, wrap, and reflect, as well as linear and nonlinear,
symmetrical and asymmetrical mapping of input to output values.
If I can find some time I'll see if I can whip up a demo patch, but
this may not happen all too soon...
> but it prefers to refer to them as mode 0 and mode 1.
lp.scampf prefers to refer to its modes as clip, wrap, and reflect
rather than "pong". I've spent too much time among the Brits to want to
pong.
-------------- http://www.bek.no/~pcastine/Litter/ --------------
Peter Castine | ^
| Litter Power & Litter Bundle for Jitter
pcastine@gmx.net |
pcastine@bek.no | iCE: Sequencing, Recording, and Interface Building
4-15@kagi.com | for Max/MSP
| Extremely cool
| http://www.dspaudio.com
| http://www.dspaudio.com/software/software.html
> On around Feb 22, 2006, at 19:26, Peter McCulloch said something like:
> > pong~ is what you want for wrapping audio signals into a given range.
> > It has two modes: pong and asteroids,
> Yet another tool for wrapping audio signals: lp.scampf, which offers
> three modes: clip, wrap, and reflect, as well as linear and nonlinear,
> symmetrical and asymmetrical mapping of input to output values.
>
> If I can find some time I'll see if I can whip up a demo patch, but
> this may not happen all too soon...
Hello,
I'm interested in the circular buffer/wrapping concept as well and was wondering if there was an example patch out there. I'm not certain what to do with the pm.pong abstract. Is there a help/demo patch of what exactly that abstract does?
Thanks,
Doug Michael
This should hopefully clarify things.
thanks,
Peter McCulloch
> Hello,
> I'm interested in the circular buffer/wrapping concept as well and was
> wondering if there was an example patch out there. I'm not certain
> what to do with the pm.pong abstract. Is there a help/demo patch of
> what exactly that abstract does?
> Thanks,
> Doug Michael
>
Having finally figured out how to wrap around the values of a buffer~ and wave~/play~ object (after only a few years, and many thanks to this post), I've been pulling my hair out trying to do the same with the waveform~ object so as to view or even select 'wrapped' values. Any ideas? I don't know what I'm missing, but I know it's been done. But HOW??!! Many pints for the correct answer :)
Thanks,
Graham
"I don't know what I'm missing, but I know it's been done."
Please tell me where did You see waveform display selected
non contiguous audio selection .
It's been done in C74's radiaL software - the colours of the waveform in the attached image are inverted, so the selection in the LCD of channel 1 is mirrored in its inspector window and if I move the selection in either window the action is mirrored. I can move it any way I like and it will keep coming around again. Trying to recreate it is turning me grey, so I've admitted defeat and wonder if anybody knows anything that could help. This is ancient yet obsolete brilliance, not to be found anywhere else...

Radial had dedicated externals, like waveslice~ and quite few others.
neither waveform nor lcd were used in the radial software.
But now that You talk about inverted color, maybe You could do just that :
instead of marking selected part of the buffer, one could mark the rest.
When wrapping , one could just revert the waveform background / selection colors
"Radial had dedicated externals, like waveslice~ and quite few others. neither waveform nor lcd were used in the radial software."
Interesting, and disappointing.
Actually, you've given me a great idea to try regarding inverting, which is to invert the start and end points for the buffer from the waveform~ selection, and wrap around like that. It's a pity not to be able to aspire to radiaL functionality due to top secret Maxness however, but I'm happy to have made some sort of progress.
Thanks for your time,
Graham