This can be tinnitus, and there can be many causes. It is best to see a doctor for this, particularly an ear nose and throat specialist, if it persists.
Possible causes/solutions if it is temporary:
Crackling caused by pressure ~ this can be stopped by swallowing-drink some water or eat a lollipop.
Crackling caused by water in the ear ~ sharply jerk your head to the side of whichever ear it is or poke around in there with a tissue or a cotton bud.