It's supposedly pretty easy. Here's an explanation from Yukari Konishi, an engineer for PlayStation:
"To reduce this burden, we have created a haptic vibration waveform design environment that anyone can use easily. In this way, we have not only developed a tool that allows game creators to design an impactful, natural and comfortable vibration waveform in fewer steps, but also created a method of almost automatically generating vibration patterns from a game's sound effects.
Konishi goes on to explain that her team was able to create a bespoke solution by consulting with experts and after researching various algorithms. The end result means that developers can "automate the generation of high-quality vibration waveforms to a certain extent, making it look as if they were created manually by the creators."
Source