title: Mapping a numpy array pairwise
body: <p>I'm currently implementing a beat detection algorithm with python and numpy/scipy.
  I basically need to read a .wav file and process it. Here is the code:</p>
  
  <pre><code>sampling_rate, wave_data = scipy.io.wavfile.read(argv[1])
  </code></pre>
  
  <p><code>wave_data</code> is a 1-D numpy array with about 441 000 elements (10 seconds of sound with 44.1 kHz sampling rate). Now, I need to do some basic math on every two elements in this array. This is how I do it now:</p>
  
  <pre><code>wave_data = [sampling_rate * (wave_data[i+1] - wave_data[i]) 
               for i in xrange(len(wave_data)-1)]
  </code></pre>
  
  <p>This opreation takes too much time (noticeable without profiling). I need to map the array pairwise "in-place", without creating a new python list. I know there is <code>numpy.vectorize</code>, but I don't know how can I do the mapping pairwise (map every two elements of the array).</p>