I want to create an add-on that plays audio

Similar to how pressing the R key in Anki plays the [sound:…] audio for the current card, I want to add the same functionality (playing the [sound:…] audio for the current card) to an add-on. Is there a way to do this?

You can add custom sounds to be played on the front/back of a card using the gui_hooks.av_player_will_play_tags hook. Check docs here: anki/qt/tools/genhooks_gui.py at 539054c34dccf8b89ca7ea9c9c40ecaf172de759 · ankitects/anki · GitHub