Since $\sin(n\cdot)$ converges weakly to zero, we know that
$$ \lim_{n\rightarrow\infty} \int_a^b g(x)\sin(nx)\mathrm{d}x = \int_a^b g(x)\cdot 0\,\mathrm{d}x = 0 $$
holds for all $g\in L^2([a,b])$.
Is there a way to find an explicit formula for the rate of convergence in the above equation, i.e. to determine a function $C$ depending on $n$ such that
$$ \left|\int_a^b g(x)\sin(nx)\mathrm{d}x\right| \le C(n), \qquad \lim_{n\rightarrow\infty}C(n) = 0 $$
holds for all $g\in A$, where $A$ is a certain subset of $L^2([a,b])$? If, for example, $A$ is the set of constant functions with $||g||_{L^\infty} < M$ for all $g\in A$, then it is easy to show that $C(n) = \frac{2}{n}M$ is such an upper bound (by integrating $\sin(nx)$).
I am particularly interested in the case where $A$ is the set of continuously differentiable (or smooth) functions with $||g||_{L^\infty}<M_1$ and $||\frac{\mathrm{d}}{\mathrm{d}x}g||_{L^\infty}<M_2$ for $M_1,M_2>0$.
The usual way that one estimates convergence of spectral methods is by iterated integration by parts, in combination with the relevant boundary condition. For example, for a pure sine series on $[0,\pi]$, the function being projected vanishes on the boundary, so one can integrate by parts $k$ times to arrive at
$$\int_0^\pi g(x) \sin(nx) dx = \frac{(-1)^k}{n^k} \int_0^\pi g^{(k)}(x) \sin^{(-k)}(nx) dx$$
assuming $g$ is sufficiently smooth that this makes sense. One can then use a suitable $L^p$ bound for $g^{(k)}$ and a corresponding $L^q$ bound for the trig functions to get a bound. For example:
$$\left | \int_0^\pi g(x) \sin(nx) dx \right | \leq 2n^{-k} \| g^{(k)} \|_{L^\infty}$$
if $g$ is $k$ times continuously differentiable and $g(0)=g(\pi)=0$.