Faulty cables can cause this, especially with the jack coming loose on the instrument cable. This can also happen if the instrument is too loud to record properly.