A cat’s purr begins in its brain, with neural oscillation (rhythmic or repetitive neural activity) that makes the laryngeal muscles twitch. This makes the vocal cords separate as the cat breathes, creating a purr.
Cats purr when they are happy, when they want to communicate with us, or when they are frightened or in pain.
I am typing this round a purring cat…