AwesomeTTS makes it easy for language-learners and other students to add speech to their personal Anki card decks.
Several text-to-speech services can be used through AwesomeTTS, including ones that run as desktop software locally on your computer and others that make audio available over the Internet. AwesomeTTS supports both on-demand playback and synchronizing audio files with your card deck, making it flexible enough for different needs.
Both Anki and AwesomeTTS are free and open-source software. You can study the source code, make changes, and contribute back to the community.