How can I transform a time signal into a third octave spectrum?
maybe either the bandpass filters or the peaking EQ filters in the audio EQ cookbook can help.  bandwidth is defined in octaves in that.  the output, $y$, of each 1/3 octave BPF filter should be squared and low-pass filtered to get the mean square, $\overline{y^2}$.  and then 

$$dB = 10 \log_{10}\Big(\,\overline{y^2}\,\Big)$$

is applied to that to get dB.

are you planning on doing this to the whole audible spectrum?  31 bands?