Testing cosmology with cosmic sound waves