The scattering of a wave from a periodic rough surface in two dimensions is considered. The proposed method is based on the use of a conformal mapping and of the multimodal admittance method. The use of the conformal mappings induces a spatially varying refractive index and transforms the boundary condition on the rough surface into a boundary condition on a flat surface. Then, the multimodal admittance method reduces this problem to a Riccati equation for the modal admittance matrix, which is solved numerically with a MagnusMöbius scheme. The method is shown to converge exponentially with the number of Fourier modes. The method also allows to find geometries having trapped modes, or quasi-trapped modes, at a given frequency, by looking at singularities, or quasisingularities, of this Riccati equation. Besides, a simple perturbation expansion, based on a small roughness approximation, is developed.