Let S be a semigroup, \(\sigma :S \rightarrow S\) a surjective homomorphism and \(\mathbb {F}\) a field of characteristic different from 2. We study solutions \(f,g :S \rightarrow \mathbb {F}\) of the functional equation \(\begin{aligned} f(x\sigma (y)) = f(x)g(y) + \beta g(x)f(y) + \gamma f(x)f(y), \ x,y \in S, \end{aligned}\) in which \(\beta \in \mathbb {F}^*\) and \(\gamma \in \mathbb {F}\) are constants. The functional equation generalizes the sine addition and subtraction laws. We show that each solution (f, g) such that f and g are linearly independent, satisfies the special cosine-sine functional equation \(\begin{aligned} f(xy) = f(x)g(y) + g(x)f(y) + cf(x)f(y), \ x,y \in S, \end{aligned}\) for some \(c \in \mathbb {F}\) , and that \(f \circ \sigma = \beta f\) and \(g \circ \sigma \in g + \mathbb {F}f\) .