Coder Social home page Coder Social logo

Comments (18)

Kruller08 avatar Kruller08 commented on June 21, 2024 3

Thank you so much, it worked!

For Mac users the file localisation is ~/Library/Application Support/Anki2 folder. It is a hidden folder so you will need to option-click on the "go" menu in finder. Click on library and locate the Application Support folder. In there you will find the Anki2 folder.

from chinese-support-redux.

frixo3190 avatar frixo3190 commented on June 21, 2024 1

ok, i've found a solution to make audio working, it's because Google Tlanslate gTTS (library) is block when use CN URL, i just replace .cn by .com (or .fr) and it's work !

from chinese-support-redux.

jw-00000 avatar jw-00000 commented on June 21, 2024 1

Changing to .com worked for me. Note though that you need to remove the old (corrupt) files! And then of course regenerate the new ones.

The procedure is thus as follows (some tips below; read everything before doing it):

  1. Quit Anki.
  2. In the collection.media folder [1], copy the names of all files of 0 bytes (= the corrupt files) and save them somewhere. [2]
  3. Then, remove all files of 0 bytes.
  4. In tts.py [1], replace cn with com on line 56.
  5. Restart Anki.
  6. Search for all notes referring to the old, corrupt files, and remove the reference to the old file. [2]
  7. Regenerate the files, using the menu item "Chinese > Bulk Fill > Sound" in Anki.

[1] You can find these folders at:

for macOS:

  • the collection.media folder at /Users/USERNAME/Library/Application Support/Anki2/PROFILE_NAME/collection.media
  • the tts.py file at /Users/USERNAME/Library/Application Support/Anki2/addons21/1128979221

for Windows:

  • the collection.media folder at C:\Users\USER_NAME\AppData\Roaming\Anki2\PROFILE_NAME\collection.media\
  • the tts.py file at C:\Users\USER_NAME\AppData\Roaming\Anki2\addons21\1128979221

[2] Here's a trick to do these steps easily using the command line on macOS.

Execute the following commands in the terminal:

cd "/Users/USERNAME/Library/Application Support/Anki2/PROFILE_NAME/collection.media"
find . -size 0 | sed 's/\.\///g' | tr '\n' '|' | sed -e 's/^/\\\[sound:\(/' -e 's/\|?$/\)\\\]/'

(The first command goes to the right folder. The second command searches the names all corrupt files, i.e. files with size 0 bytes, and then removes the ./ prefix, concatenates them into with |, and adds a something in front and at the end.)

This should generate an output like

\[sound:(a.mp3|b.mp3|c.mp3)\]

Copy this.

For step 2, you can delete the files in the Finder by sorting by size and deleting the files with size 0 bytes.

For step 6, in Anki, go to the Browse window, and to the menu Notes > Find and Replace...
Paste the output from above in the "Find" box, and leave "Replace With" empty. Make sure to select "Treat as regular expression" and apply this replacement to all notes.

Note: on Linux, the same commands should work in the right folder.

I'd advise to make a back-up of your Anki profile before executing these commands :)

from chinese-support-redux.

gdelmee avatar gdelmee commented on June 21, 2024

I have the same issue.

  • OS: WIndows 10
  • Anki Version ⁨2.1.49 (dc80804a)⁩, Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
  • Chinese Support Redux v0142

from chinese-support-redux.

gdelmee avatar gdelmee commented on June 21, 2024

Switching from Baidu to Google, the MP3 is fine.
It seems the issue comes from Baidu's integration.

from chinese-support-redux.

gdelmee avatar gdelmee commented on June 21, 2024

Update on this issue.
As of now, neither Baidu or Google are working.

For Google, files are empty, for Baidu, the file is broken:

image

image

from chinese-support-redux.

frixo3190 avatar frixo3190 commented on June 21, 2024

hi

Me too I've recently this trouble !

How to do ?

from chinese-support-redux.

Kruller08 avatar Kruller08 commented on June 21, 2024

I have the same issue.

OS: MacOS monterey

Anki: Version ⁨2.1.44 (b2b3275f)⁩

from chinese-support-redux.

frixo3190 avatar frixo3190 commented on June 21, 2024

Thé trouble is due to an issue of gtts librairy used by the plugin

pndurette/gTTS#363

from chinese-support-redux.

Kruller08 avatar Kruller08 commented on June 21, 2024

Thank you frixo for the solution. Can you describe how to change the url from .cn to .com please?
I don’t know how to do it.

from chinese-support-redux.

frixo3190 avatar frixo3190 commented on June 21, 2024

you're on Mac, I'm on Windows. So the file localisation isn't the same. I suppose you will found a folder called Anki in your library (the library in your user folder (it's perhaps a hidden folder))
in Anki folder you've an AddOn Folder and then you will find the folder with the IF of ChineeseAddOn.
In this folder find the file names : tts.py, and go to line 56 , replace cn by com

it looks like that :
def get_google(self):
tts = gTTS(self.text, lang=self.lang, tld='com')
try:

On Windows the file is here : C:\Users\YOUR_USER_NAME\AppData\Roaming\Anki2\addons21\1128979221

from chinese-support-redux.

proto455 avatar proto455 commented on June 21, 2024

Still cannot get audio to play. I replaced my tts.py 'cn' to 'com' but still no luck. On MacOS Monterey 12.5.1. Neither Baidu or Google audio working.

When I go to ->Tools->Check Media

I get the following error:

Missing files: ⁨1⁩
Unused files: ⁨0⁩

The following files are referenced by cards, but were not found in the media folder:
Missing: 你好_google_zh-CN.mp3

But when I go to my /Users/proto455/Library/Application Support/Anki2/User 1/collection.media

I am able to find the file in question, however it will not play via VLC or any other application.

Sorry if fix is obvious, new here and really would love to get this working

from chinese-support-redux.

souchi007 avatar souchi007 commented on June 21, 2024

Hello !
Thank you for the help, I had the same problem but now it works thank to you. I use Google audio.
At first I changed the 'cn' to 'com' and it still didn't work. But then I changed it to 'fr' and now it works, thanks !

from chinese-support-redux.

frixo3190 avatar frixo3190 commented on June 21, 2024

from chinese-support-redux.

jwolf112 avatar jwolf112 commented on June 21, 2024

Hello - I was experiencing the same issue as the original poster after updating Anki to 2.1.54 Qt5 on Windows. For me, the advice on this thread allowed me to resolve the issue, but only when using Speech Engine "Google Mandarin (Taiwan)", not "Google Mandarin (PRC)" or "Baidu Translate". I just wanted to note that in case in helps anyone else.

Thank you all who helped find a work around for this issue!

from chinese-support-redux.

kaysik avatar kaysik commented on June 21, 2024

'cn'->'com' fix only works for new cards (as in new text). Initially I thought changing 'cn' to 'com' as above did not work because it didn't fix my broken cards. However it does work for NEW cards (which generate a new unique file name), but does NOT fix already broken ones. Even if you delete the text in your cards audio field, and have it re-generate the audio, the old corrupted file is still found will still be used - it doesn't actually generate a new audio file if it can find an old one.

So to fix old, already broken cards you must delete the old broken files. On windows they can be found here:

C:\Users<YOUR USER>\AppData\Roaming\Anki2<YOUR PROFILE>\collection.media\

(if, like me you had quite a few busted ones you can just sort by size and delete anything with a size of 0).

Once deleted the sounds can now be re-generated and this time they'll work.

from chinese-support-redux.

BeorTheOld avatar BeorTheOld commented on June 21, 2024

I recently moved to Taiwan and this is when I first noticed the problem, it wont work even if I delete all the 0 kbs files and change the cn to com, however I used a vpn to say I was in America and the files work now.

from chinese-support-redux.

IrIougER avatar IrIougER commented on June 21, 2024

I've followed the advice in this thread. Still cannot get the sound to work.

from chinese-support-redux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.