thanks for the suggestions, here&#39;s the solution I came up with.<br>gr,<br>Tim<br><br><br><div class="gmail_quote">2012/5/22 Claude Heiland-Allen <span dir="ltr">&lt;<a href="mailto:claude@goto10.org" target="_blank">claude@goto10.org</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 22/05/12 02:13, tim vets wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have lists of floats from measurements which vary in length<br>
(they grow with the duration of the measurements)<br>
What would be a good way to map those to a list of, say, 150 items?<br>
In concreto:<br>
-When variable list A has 15 elements and fixed list B is 150 long,<br>
I can simply repeat each value of A 10 times to get a 150 elements list.<br>
-When list A has 1500 elements, and B 150, I could take list A 10 elements<br>
at a time,<br>
and write the averages thereof to list B.<br>
but how do I generalize this for _any_ length of list A?<br>
</blockquote>
<br></div></div>
look into resampling, eg libsamplerate[1]<br>
<br>
when #A &gt; #B you want to low pass filter to antialias when downsampling<br>
when #A &lt; #B you want to interpolate     to antialias when   upsampling<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
and how do I patch this up in pd? :)<br>
</blockquote>
<br></div>
very temperamental/buggy version attached, especially the filtering is a bit rubbish in this one - it just uses a couple of simple causal lop[2] instead of doing it properly<br>
<br>
for upsampling, tabread4 does one kind of interpolation (but you might want to use a different interpolation function, refer to the list archives about tabread4c etc)<br>
<br>
for downsampling, you might want an acausal filter (like an image blur that works in all directions without shifting the image sideways) - most audio filters are causal (one direction only - the direction in this case is time, and the future can&#39;t influence the past, so there&#39;s some delay)<br>


<br>
you might want to store statistics too, depending on the type of data (eg: in an audio scope like audacity you can see long-scale peaks/troughs even though the average antialiased visible signal would be a line at 0 assuming no DC offset) - you might pick up some ideas from the description of zoom-cache[3]<br>


<br>
[1] <a href="http://www.mega-nerd.com/SRC/" target="_blank">http://www.mega-nerd.com/SRC/</a><br>
[2] <a href="http://en.wikipedia.org/wiki/Low_pass_filter#Discrete-time_realization" target="_blank">http://en.wikipedia.org/wiki/<u></u>Low_pass_filter#Discrete-time_<u></u>realization</a><br>
[3] <a href="http://hackage.haskell.org/package/zoom-cache" target="_blank">http://hackage.haskell.org/<u></u>package/zoom-cache</a><span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
Claude<br>
</font></span></blockquote></div><br>