Please modify your post and add code tags => # button above the smileys.
For Whistle patterns you might need to do an FFT to get the frequency out ?
For knocking you can simply stick with amplitude.
If you just want to check the Whistle on amplitude (so the rythm/pattern) an FFT is not needed, it should work similar to the knock sketch.
First thing to do is to start listen for a time and create an array of timestamps a whistle is detected. If it has no sound for e.g. 3 seconds it creates from the timestamps an interval array consisting of three letters. Short Medium, Long
Short being every interval between 0.1 and 0.3 second, Medium everything between 0.3 and 0.7 second and Long everything between 0.7 and 1 second. (or just use S and L)
Then you compares this "SML"-array with one or more predefined "SML" arrays.
If there is a match => action;
else => nothing
clear input arrays