Well, basically you want to feed the sound output into one of the Arduino's analog input pins; once you've done that, you can use the analogRead() function to get a voltage level (corresponding to the waveform's voltage reading) as a value 0-1023 into an integer variable. Once you have it stored in the variable, then the tricky part (but code does exist out there for this - somewhere) would be to feed the values (as a small array of integers, I would imagine) into a FFT algorithm/function, in order to process the waveform sampled into whatever number of frequency bands you desire; from there you can use those levels to drive whatever other code you need. Now, the audio input will be tricky - you are probably gonna want to measure it; it should be around 1V peak-to-peak for regular line-level outputs, but it can vary.
PWM is not recommended by the fan manufacturer Sunon on the grounds of reliability. Also with PWM there is not much in the way of speed control as a fan does not have much of a load and PWM works best for a motor when it is under load. Adding a capacitor is in effect smoothing the PWM and giving you more of a DC signal. A fan working with a current of 160mA is no problem to drive with a FET in the liner mode.
After making the Blow sensor and seeing how easy it might be to replace the piezo circuit with an electret microphone using the simple amplifier of the Nerdkits for their " Piezoelectric sound meter " project. We decided to document an example that can capture sound with the electret microhone, read it in Arduino and send that data to Processing to finally make a text dance to the rhythm of the music. If we follow the circuit of Figure 1 the only change is to replace the Piezo Buzzer with an electret microphone, we also had to adjust the potentiometer circuit so that Vout is 2.5 volts to achieve a maximum dynamic range. As such, the visualization was better when data was sent to Processing . Downloads:
We designed these sensors for an interactive installation in which a user has to blow on a point projected on a wall. When the system detects that a user has blown on the point, it will activate different projections and interactions surrounding the person. The sensor was supposed to be as minimally intrusive as possible because the projection was done over the same wall and we didn´t want any visual bumps over the projection, like a microphone would do.