Phonons have the characteristic linear dispersion relation of massless relativistic particles. They arise as low-energy excitations of Bose-Einstein condensates and, in nonhomogeneous situations, are governed by a space- and time-dependent acoustic metric. We discuss how this metric can be experimentally designed to realize curved spacetime geometries, in particular, expanding Friedmann-Lemaître-Robertson-Walker cosmologies, with negative, vanishing, or positive spatial curvature. A nonvanishing Hubble rate can be obtained through a time-dependent scattering length of the background condensate. For relativistic quantum fields, this leads to the phenomenon of particle production, which we describe in detail. We explain how particle production and other interesting features of quantum field theory in curved spacetime can be tested in terms of experimentally accessible correlation functions.