title: How to add two partially overlapping numpy arrays and extend the non-overlapping parts?
body: <p>I'm adding a short audio signal (1-D numpy array of a musical note) to roughly the end of a longer signal (the first part of the audio stream constructed so far). I'd like to add the overlapping part and extend the non-overlapping part. What is the most efficient way to achieve this? I can identify the overlapping part and add it to the main signal while concatenating the non-overlapping part, but I don't think this is sufficiently efficient. I also think make them the same size by padding with zeros is very memory inefficient. Is there a numpy or scipy function for achieving this?</p>
  <p><a href="https://i.stack.imgur.com/bQLfJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bQLfJ.png" alt="enter image description here" /></a></p>