title: concatenate sinusoids of varying frequency
body: <p>It's my first time working with audio and I'm trying to concatenate sinusoids of arbitrary (data-driven) frequencies, and can't get rid of the clicking noises caused by discontinuities in between the sins. </p>
  
  <p>I was reading <a href="https://stackoverflow.com/questions/11199509/sine-wave-that-slowly-ramps-up-frequency-from-f1-to-f2-for-a-given-time">this thread</a> on making frequency a function of phase in order to increase the frequency of a wave linearly, but couldn't figure out how to adapt this for arbitrarily shifting frequencies. </p>
  
  <p>I was playing around with calculating the phase shift from the previous sinusoid, and then trying to shift the next one accordingly, but this just seemed to make the sound more high pitched and didn't remove the clicking.  </p>
  
  <pre><code>def audio_map(data):
  p=[]
  phase = 0 
  for point in data: 
      if point[0]&lt;0: 
          f=100*np.abs(point[0])
      else:
          f=100*point[0]
  #Do something with the phase to shift the sinusoid below??? 
  p=np.concatenate((p,np.sin((4*np.pi*f/sampling_rate)*np.arange(sampling_rate*np.pi/(16)))))
      phase=f*np.pi/16
  
  return p
  </code></pre>
  
  <p>Thanks for any help!!</p>