Jump to content
Chinese-Forums
  • Sign Up

Looking for a way to mass import audio files for Anki cards


pon00050

Recommended Posts

This post talks about the previous studying routine that I had set up.

It mostly consisted of using the Lua script to automtically generate Anki cards after going through the scripts of a Chinese drama with the help of the Chinese Text Analyzer, a wonderful program made by Imron.

 

I also played with Auphonics to utilize its Automatic Speech Recognition, thereby generating not only an enhanced version of the audio but also subtitle files.

 

Recently, I had an eureka moment and got myself a script written in Python.

This script receives a mp3 file and subtitle file as input and results in two output files.

Two output files include a bunch of smaller/shorter audio files split according to the time stamps indicated in the subtitle file for each sentence.

The other output file is an excel spreadsheet that lists the audio file numbers and corresponding texts.

 

In an effort to have real-human voice recording attached to the Anki cards, I inserted the individual audio files created by the above Python script.

 

And now, I am wondering, is there a way to add even more automation to this process?

I'd like to automate the part that I am manually adding audio files.

I already have the Python script written in a way that each sentence is numbered and this data is recorded on the spreadsheet.

 

If anyone can help, please do share their insight and I will appreciate it a lot.

 

 

 

 

screenshot of generated audio files.PNG

06.csv anki-export.lua subs.py

  • Like 1
Link to comment
Share on other sites

If I understand correctly, I think you've already done all the hard parts. Anki lets you update existing notes by importing text files.

  • Create a spreadsheet where column A contains the texts that match existing cards and column B contains references to the audio files using Anki's syntax (e.g. "[sound:ni3hao3.mp3]").
  • Save this spreadsheet as a tab-separated text file.
  • Create a field in your notes for the audio file reference.
  • Copy all the MP3 files into Anki's media directory.
  • Import the text file into Anki, making sure to select the option for updating existing cards.
Link to comment
Share on other sites

I've done this the way @大块头 suggests too.

I think there is one part missing though. The csv import will only import the cards, but not the media files so you need to manually place the mp3 files in the Anki media folder. When Anki sees that [sound:ni3hao3.mp3] syntax it will just look for that file in the media folder and use it if it finds it.

 

You can for example create one card manually, then export it into csv, then use that as the template to create the rest of the cards using python, vim macro or whatever, and finally import the cards back to the collection.

 

An easy way to find the media folder is to just to copy the file name of some file you know works in Anki from the csv and then search for it.

Link to comment
Share on other sites

On 10/12/2021 at 2:22 PM, alantin said:

I think there is one part missing though. The csv import will only import the cards, but not the media files so you need to manually place the mp3 files in the Anki media folder. When Anki sees that [sound:ni3hao3.mp3] syntax it will just look for that file in the media folder and use it if it finds it.

 

Thanks, I revised my earlier post to include this step.

  • Like 1
Link to comment
Share on other sites

On 10/12/2021 at 3:42 PM, brownnoser said:

is auphonics like the auto-generated subtitles on youtube?  in that in only work wells if there isn't a lot of background noise/music, sound effects etc

 

Please look into Auphonics and try for yourself. I don't believe that it's like auto-generated subtitles on YouTube. 

I even provided the link in the original post. Results may vary but my experience has been that Auphonics does a pretty good job of generating transcripts/subtitles for me. Also, Auphonics mainly intends to get rid of the background noise and enhance the audio quality. So you get both, which is what I also mentioned in the original post.

Link to comment
Share on other sites

Join the conversation

You can post now and select your username and password later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Click here to reply. Select text to quote.

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...