I think there are two main levels: physical and psychological.
At the physiological level, music can stimulate the pig's autonomic nervous system, and its main function is to regulate the pig's heartbeat, respiratory rate, nerve conduction, blood pressure and endocrine. Therefore, scientists found that soft music slowed down the blood circulation in the pigs' brains; while lively music increased the blood flow rate in the pigs' brains. In addition, high-pitched or fast-paced music can make pigs' muscles tense, while low-pitched or slow music can make them feel relaxed.
At the psychological level, music causes an autonomous response in the brain that is responsible for the pig's emotions and feelings, causing the mood to change. Many studies have shown that calming or happy music can reduce anxiety in pigs.