Anki add-on: Advanced Answer Sounds

This add-on modifies "Answer Button Sounds" add-on and adds more options, with a new sound effect adds when the card has the type field and people type answer with error cause the error sound playing and notifying people. 20240810 1: Ambient musics support extra paths: in Config Dialog, you can add or remove extra folders in a FolderList Dialog. So you don't need copying musics to the addon's folder. 2: Ambient musics repeat mode change to : random play /single play /sequence play. 20240731 1: Support adjust volume of the Answer Sounds, the controls are not global but seperate. 2: Volume control only support 8bit /16bit sounds, not include 24bit/32bit. 20240530 1: Support qt5 version, because QMediaPlayer in qt5 only play wav, mp3,wma files, so default ambient music files added 2 mp3 files which make the addon more big. 2: When in overview page, the ambient music will delaying somtime and play after the finish deck sound ended. 20240528 1: Support ambient music in review and menu mode, this function use the QMediaPlayer to play music which can support wav, mp3, aac, flac files. Default ambient music files with 8 aac files and make the addon a little big. 2: Change config from menu to dialog and you can conifg all the param by once. 20240430 1: Try to support Linux and macOS, tested by virtual system and seems worked well with lastest version. 2: Refer to https://ankiweb.net/shared/info/978869609 <Play a celebration/completion sound when you finish your deck>, also add this effect in this addon with option "finish deck". 3: Fix some bugs. 20240402 1: Add _simpleaudio.cpython-38-darwin.so to the module simpleaudio and try to support macos, suggest youself pip install simpleaudio and extrack out needed fils(just like in python env, try pip wheel simleaudio to get the .whl file and extrack the needed file). 20240330 0: This version maybe a full new version compare with the old ones, if it doesn't fit for you needs, you may not upgrade this version. 1: New import a python module: “simpleaudio” which play the sounds more quickly instead of the embedded mpv, because old version must use the same mpv to play effect sounds and normal sounds tag. The old version must insert the the current card's answered sounds in the next card's question sound tag list, so there always some delay. I just copy the windows's files of this module to addon directory, so if you run in linux or mac, I think you can pip install simpleaudio and copy needed files to this addon's directory. 2: This version will preload the sounds wave file to memory by "simpleaudio", and this module only support wave file, so the customed sounds file must change to wave file. Preloading wave files to waveobjs maybe delay the anki's startup. 3: For the simpleaudio plays effect sounds simultaneously with the mpv play normal sound, there are some new configs for delay the question and answer sounds playing and showing: a. Delay question and answer sound play by insert silence wave files before the normal sounds in the avplayer's list for not mixed with the effect sounds. b. Fadein quesion and answer card's show for the delayed normal sounds play. c. For the graduated status must changed after the answer's ease type, so the graduated sound can configs to play simultaneously with ease sound or to delay some time. d. All the configs can be disable/enable and adjust the time.( the silence delay times only support times of 0.5s duration) 20240127 1: Support <Multi-Line Type Answer Box - 2> addon 20240116 1: Support sound effect: answering correct; 2: Support sound effect: card is graduated(card's queue from new/learning to review, I think this is graduated); 20231213 1: Support new year type version. 20220529 1:Change the effect sounds to their name's folder, when the add-on need play effect sound, it will random select one sound file to play. and the sound type is (wav|mp3|ogg|flac|m4a|oga). The "sound_new_agains":true param is removed, and the new agains sound file---"Lego Star Wars- The Complete Saga - All Death Sounds.wav" has been cutted to single sound file to the again folder. If you need more other sound effect, you can put the sound files to the named folders. 20220518 1:Add enable/disable sound delay menu on tools->Advanced Answer Sounds->sound delay on/off for no need to change config setting and restart Anki. And default sound delay is Disiabled. 20220517 1:Support click 'again' answer button to play ramdom sounds from the wave file, and it can switch with old again sound with config param: "sound_new_agains":true ----random use one segment of "Lego Star Wars- The Complete Saga - All Death Sounds.wav" 2:Support add by sleep times to delay the answer button's sound befor the next question card show, it can adjust by new config param: "sound_delay_time":0.8 -----if delay time bigger than zero, when you click the answer button, app will block the delay time to show now answern card then show next card's question. Because this addon develop by insert the answer sound file to the next card's question audio queue, if there is no delay time, it seems that current card's answer sound play at the next card's question show, but the app run the delay time will block the answer button's click, you can set the delay time by 0.0 to disable this delay. 20220509 1: Fix the bug for no card's sound play only answer sound. 20211230 1: Fix Bugs for no sound play with "Advanced MPV Player" add-on: mpv play need "pause=no" option. Update 20211229: 1: Support Suspend And User Bury And Sched Bury Sounds effect above Anki 2.1.35 version, because above ver2.1.35, anki change a lot of codes so maybe this update has some unknown problem. BTW: Above 2.1.35, anki adds another mpv player for play video, so this add-on remove this SimpleMpvPlayer and seems work well if you mind this change you can skip this update. Update 20211225: 1: Fix a bug for not right sound with easy type change. 2: Update Config params for control sounds' volume and length when use mpv to play answer sounds: "start":0.0, "end":0.0, "volume":100 In mpv: --volume=<value> Set the startup volume. 0 means silence, 100 means no volume reduction or amplification. Negative values can be passed for compatibility, but are treated as 0. --start --end can adjust the sound play length if use a long time audio file just want a clip time. 3: Support "Advanced MPV Player" when you also use this addon, and you need update "Advanced MPV Player" to the latest version Update 20211031: 1: Use another API to avoid error for using in higher version than 2.1.35 for bury and suspend sound. Update 20211030: 1: Support Suspend And User Bury And Sched Bury Sounds effect, "suspended": { "enable":1 }, "user buried": { "enable":1 }, "sched buried": { "enable":1 } the sound wave files in user_files Update 20210628: 1: Fix the bug when replay card's audio will play the effect sound. Update 20210602: 1: Add enable/disable sound menu on tools->Advanced Answer Sounds->again on/off and others on/off for no need to change config setting and restart Anki. Update: 1: Use a new way to enque the sound file to the native av_player's playlist to fix some bugs. 2: New config file only include enable/disable option because the sound play used the native av_player. The config file includes these options, you can enable every sound and adjust the playing time and volume. { "again": { "enable":1, "wait_time": 0.6, "volume": 100 }, "hard": { "enable":1, "wait_time": 0.6, "volume": 100 }, "good": { "enable":1, "wait_time": 0.5, "volume": 100 }, "easy": { "enable":1, "wait_time": 0.5, "volume": 100 }, "error": { "enable":1, "wait_time": 0.5, "volume": 100 } }