The uncertainty principle limits the resolution of frequency and time (damn you, heisenberg!). So you can’t get a good resolution in time (sample per sample) and a good resolution in frequency. There’s always a trade-off between the two.
You might wan’t to take a look at the discrete Fourier-transform, which takes a number of samples and analysis the frequencies which occur within that time-window. An efficient implementation of it is the fast-fourier-transform (FFT), there’s also a JUCE class which performs the fft.
There’s also a long discussion on the JUCE forum with some information about special windows you can apply to the time-signal, and overlapping the transformed blocks, to get a better frequency representation of your input signals: FFT Amplitude