[Userscript] KaniWani audio

This is a quick hack for the male voice:

Change:

var audioNode = domRoot.querySelector('audio');

To:

var audioNode = domRoot.querySelectorAll('audio')[1];

Is there anybody out there who can help me to get this to work on Safari on a Mac please?
I get as far as seeing the ā€˜PLAY AUDIOā€™ button but only with a continuously spinning dial.

1 Like

Finally noticed your reply haha that totally works, thank you!

1 Like

This script only produces audio for the very last review in a session and none of the prior reviews.
Is anyone else seeing this or able to get audio for their other reviews?

Hi @Kumirei, as Iā€™ve seen you in this thread and you have been so helpful recently I was just hoping you might be able to shed some light on why this is happening ā€¦ or point me to the man who can (itā€™s my guess that is you anyway).

I havenā€™t used KW for years so sadly I am of no help. Maybe @crumpet could help you

2 Likes

Without realising I had the auto-advance delay set to zero within settings which wasnā€™t giving the audio a chance to play. Setting to 1s appears to be ideal (if wishing to continue using auto-advance).
All is well again.

2 Likes

Glad you got it sorted

2 Likes

Looks like there has just been an update to this script that allows you to set auto-advance delay back to zero and have this script working perfectly again without the need for a delay at all.

Certainly speeds things up.

Thanks to whoever did this, whoever you are?

1 Like

Hi! That would be me! :slight_smile:
Glad it was helpful!

1 Like

Hmm - complete noob here - How do I add the shortcut code to the script. I can edit the script but no matter how I paste it the script just wonā€™t run until I remove what i added.

Iā€™m trying the add the J-key shortcut

Thanks!

Hi, thanks for fixing the script. I reset my KaniWani and was doing some lessons after reinstalling the script but couldnā€™t figure out why the sound wasnā€™t playing. The script thatā€™s on the The New And Improved List Of API and Third Party Apps by synecdoche doesnā€™t work but yours does. I hope you donā€™t mind but Iā€™ve updated The New And Improved List Of API and Third Party Apps with your script.

1 Like

Thanks for doing that!

1 Like

Anyone else having problems with this script? Works fine for the first word of a review/lesson but then stops playing audio. Iā€™m using Chrome.

UPDATE: Works fine in Edge

1 Like

I wanted to have the voice selection at random so I changed the line 243 for:

// var audioNode = domRoot.querySelector(ā€˜audioā€™);
var allAudioNodes = domRoot.querySelectorAll(ā€˜audioā€™);
var elem = Math.floor(Math.random() * allAudioNodes.length);
var audioNode = allAudioNodes[elem];

I updated so it would always play regardless if you get it right or wrong.
I find that hearing it reinforces recall.

// Line 153
        if (target && window.getComputedStyle(target).backgroundColor === 'rgb(127, 212, 104)' || window.getComputedStyle(target).backgroundColor === 'rgb(127, 212, 104)') {

1 Like