For f(x) to be continuous on R, it must be continuous at x=−1 and x=1.
At x=1: from the right, x→1+limsin(πx)=sinπ=0. From the middle piece, f(1)=∣a+1+b∣. For continuity, ∣a+1+b∣=0, so a+b=−1.
At x=−1: from the left, x→−1−lim2sin(−2πx)=2sin(2π)=2. From the middle piece, f(−1)=∣a−1+b∣=∣a+b−1∣=∣−1−1∣=∣−2∣=2. This is consistent, confirming continuity at x=−1.
Therefore a+b=−1.