Gravitational waves from primordial scalar and tensor perturbations