Piecewise smooth solutions for 1D wave equations with discontinuous velocity and singular source term