title: Sound echo function Python
body: <p>I need to write the function echo, that takes in a filename as and a floating-point value time_delay, which represents a number of seconds.Then, echo should handle the sound, with the original sound being overlaid by a copy of itself shifted forward in time by time_delay.</p>
  
  <p>This is what I have so far:</p>
  
  <pre><code>def add_scale_2(L, M, L_scale, M_scale):
  """ add_scale_2 has as intput list L and list M and rertuns a new list LC, 
      with a linear sum of the two lists times their scale respectively. LC will use the length of the 
      shortest list
  """       
      if len(L) &gt;= len (M):
          N = len(M)
      else:
          N = len(L)
  
      LC = [L[i]*L_scale + M[i]*M_scale for i in range(N)]
      return LC
  </code></pre>
  
  <p>And:</p>
  
  <pre><code>def echo(filename, time_delay):
      print "Playing filename1 ..."
      play(filename)
  
      print "Reading in the sound data..."
      samps1, sr = readwav(filename)
      samps2 = [0]*float(samps1*time_delay) + samps1
  
      print "Computing new sound..."
      newsamps = add_scale_2(samps1, samps2, 0.5, 0.5)
      newsr = sr # no change to the sr
  
      writewav( newsamps, newsr, "out.wav" )
      print "Playing new sound..."
      play( 'out.wav' )
  </code></pre>
  
  <p>Can someone help me please because I can't figure it out!</p>
  
  <pre><code>    samps2 = [0]*int(samps1*time_delay) + samps1
  TypeError: can't multiply sequence by non-int of type 'float'
  </code></pre>