I am using a Raspberry Pi 3 B+. I want to play audio through the 3.5mm jack and use PWM at the same time or successively to simulate a IR-Remote. I know that you can't use the hardware PWM while playing audio, becouse the 3.5mm jack uses the hardware PWM to generate the analog audio output.
I use the pigpio library (in a code similar to this) to generate and send a wave to the IR-Led (on pin 22). I read on other pages, that pigpio uses DMA to send the wave signal and thus should not need the hardware PWM.
Still when I send the wave to the GPIO the audio crashes and I need to reboot the Raspberry Pi to get the audio working again.
So my question is, why does the audio output crash when sending the wave although pigpio don't use the hardware PWM (or did I get that wrong) and how can I prevent that crash?
If I can't prevent that crash how can I restart the audio system to play some audio after sending a wave to the GPIO.
Edit:
Although I found different informations about the use of hardware PWM in the pigpio library, the wave function uses the hardware PWM and you can't use audio at the same time.
Now my question is how can I switch back to "audio mode" after using the GPIOs with PWM?