16

I am looking for simple converter from mp3 to txt. I have tried, without success: julius, CMU Sphinx, ... In the past 4 hours I did not find a way how to use them (or properly install them).

What I am looking for is something like:

$ converterapp -infile myspeech.mp3 -outfile myspeech.txt

I am also fine with GUI application since I only have a few files to convert and can click around.

Edit: With the help of this answer Speech-recognition app to convert MP3 to text? I manged to get it working but it produces no output. Well, actually it produces a couple of blank lines (no words detected)...

2
  • What is the exact command you run and the output you see? Commented Oct 15, 2016 at 16:56
  • 1
    $ pocketsphinx_continuous -infile 1.wav -hmm en-us/cmusphinx-en-us-5.2 -lm en-us/en-70k-0.2.lm -logfn /dev/null &>otput.txt is the exact command as per @NikolayShmyrev question. I have downloaded the models from sourceforge.net/projects/cmusphinx/files/… .
    – Samo
    Commented Oct 17, 2016 at 12:09

3 Answers 3

11

pocketsphinx will do speech to text from an existing audio file. Depending on the initial format of the mp3, you may need two separate commands.

First convert your existing audio file to the mandatory input format:

    ffmpeg -i file.mp3 -ar 16000 -ac 1 file.wav

The run pocketsphinx

    pocketsphinx_continuous -infile file.wav 2> pocketsphinx.log > myspeech.txt

the created file myspeech.txt will have what you're looking for.


In case you are new to ubuntu, you would need to install the above programs using this command:

    sudo apt install pocketsphinx pocketsphinx-en-us ffmpeg
1
  • 1
    Funny how pocketsphinx-en-us isn't a dependency or even not having it installed doesn't generate an error when executing.
    – Adam
    Commented Jun 23, 2020 at 20:15
6

OpenAI's Whisper (link to press release) is a relatively new free and open-source alternative, with pretty good performance in multiple languages.

There are a few ways to install it, you can do so via pip, python's package manager: pip install -U openai-whisper

$ whisper audio.mp3 --model medium

A comment below points out that the use of a python "virtual environment" may be suggested. This is a way for python's pip to install software in a subdirectory, therefore not impacting the rest of your system:

$ # Creates a new environment called "newenv" (also creates a subfolder with the same name)
$ python -m venv newenv
$ # Activate the new environment by sourcing the bin/activate script from the new folder
$ source ./newenv/bin/activate
(newenv)$ # pip will now install modules in the venv, and python will use modules from there
(newenv)$ pip install -U openai-whisper
(newenv)$ whisper audio.mp3 --model medium
(newenv)$ deactivate  # exit the venv (once you are done)
$
3
  • This sounds like a great answer, but I think it can be improved. Typing pip install -U openai-whisper gives some error message about this being an external environment and requiring a virtual environment, blah blah, lots of things that are incomprehensible unless you're an experienced Python developer.
    – k314159
    Commented Mar 26 at 15:30
  • 1
    @k314159 It didn't display this for me last time I tried it, but I added a short tutorial to my answer instead of leaving that in my previous comment (which I am deleting).
    – MayeulC
    Commented Mar 27 at 15:16
  • 1
    Thanks, that looks good. Another way to install whisper, which I tried successfully yesterday, is to use pipx.
    – k314159
    Commented Mar 27 at 15:25
1

Mozilla SpeechDeep opensource speech-to-text tool will do. You will need to install the application on your linux desktop. Or you can try Transcribear a browser based speech-to-text tool that does not require installation, but you will need to be connected online to upload the recording to the server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .