There is a good, time-tested tool for processing audio, sox. Surprisingly, it managed to merge two audio tracks without any surprises after a series of unstable results with avconv. For example, avconv can merge two tracks of the same time, and one of them exits before the other. Accordingly, when overdubbing, the sound can “move out” a lot, especially on long rollers.
sox -m in1.wav in2.wav out.wav
-m – an option specifying the mixing mode for input files. Without options, sox will simply concatenate the files, adding the second one after the first.