Sweater is made of wool and generally shirt we wear is made of cotton blended with some synthetic fibers. Constant friction between the shirt and sweater lets transfer of electrons from one material to the other. This results in building of electric potential. When enough potential has been accumulated, while taking of the sweater it discharges and transfer of electrons take place. Passage of electrons through air in the forms of spark let out heat and sound energy. Thus we hear the crackling sound and in dark rooms we may see the spark lights as well.