a.c. Conductivity of nearly commensurate charge density waves and application to NbSe3 and TaS3