The last missing piece of hardware to complete the MagicHat is the mouth
The mouth will be a simple VuMeter that continously read the line output from the USB audio card and switch on LEDs accordingly
LEDs will be switched on from the center to the sides to give the impression that the mouth is more open when the sound is louder
Here is the circuit schematic
and here is the flowchart of the code that switches on and off LEDs
NOTE: (threshold1 < threshold2 < threshold3 < threshold4)