This script was adapted to allow you to play audio files through your microphone input. It does so by creating a virtual microphone and piping an audio file to it.
The work was mostly done in this StackOverflow answer, I just adapted it to use ffmpeg and add a trap to cleanup on exit.
Requirements:
- ffmpeg
- Bash
- PulseAudio/pactl
@AggamR The cleanup() function is executed twice: first at line 33, and then a second time when the script traps the EXIT pseudo-signal. That's why it will error, because the script will try to unload the module twice.
Fix: Just delete line 33.