Here is a PID controller (proportional, integral, derivative) in Max that controls the pitch of an oscillator so you can watch how a process responds to various setting of PID coefficients. It features an external perturbance generator (ie., noise maker) to check how fast the system can adjust and continue.
Tried using fiddle~ for frequency detection (as the sensor input) but it provides faulty data below about 200hz – and that totally messes up the PID. so I am just using the actually frequency being used to set the oscillator as the response sensor.
update: Tristan Jehan wrote a Max external that extends lower frequency range of [fiddle~]. It would be worth trying for this patch.
- turn on audio
- change test interval to something like 20
- click on message boxes to change set point. Listen and watch results
- try different presets – which alter PID settings and then try changing the set point. For example, with the 2nd preset you will see overshoot and oscillation during settling phase.
more about PID controllers
wikipedia page: http://en.wikipedia.org/wiki/PID_controller