Day: May 5, 2019

Testing Mozilla DeepSpeech

These are the steps to test deepspeech 0.4.1 on Linux Ubuntu 18.04:

Install libsox and fake it as libsox2:

$ sudo apt-get install libsox-dev

$ ln -s

Record your voice:

$ rec -c 1 -r 16000 -b 16 recording.wav

Alternatively download the audio from google translator and convert to wav 16bit 16khz mono:

$ ffmpeg -i the_quick_fox_jump_over_the_lazy_dogs.mp3 -acodec pcm_s16le -ac 1 -ar 16000 recording.wav

Test it:

$ ./deepspeech --model ../deepspeech-0.4.1-models/models/output_graph.pbmm --alphabet ../deepspeech-0.4.1-models/models/alphabet.txt --lm ../deepspeech-0.4.1-models/models/lm.binary --trie ../deepspeech-0.4.1-models/models/trie --audio recording.wav
TensorFlow: v1.12.0-10-ge232881
DeepSpeech: v0.4.1-0-g0e40db6
the quick brown fox jump over the lazy dog

Using sed command to replace newlines

WordPress is always modificating their software to improve speed and try to bring good things to users. Unfortunately the Block editor is not a good these things, at least not for me.

Recently while editing my post about my list of musics ( ) it placed the new lines between Music (Musica) and Artist (Cantor).

Then it became:

Music: Blablabla

Artist: Blabla

Music: Blablabla2

Artist: Blabla2

I wanted to restore the old organization:

Music: Blablabla
Artist: Blabla

Music: Blablabla2
Artist: Blabla2

Instead editing it be hand I tried to use VIM text editor, but vim recognizes \n as \0. And although there are some other ways to get it working on vim, Ctrl+J etc didn’t work as expected.

Then I remembered that sed -i could do the trick:

I tested this idea:

sed -i 's/\n\nCantor/\nCantor/g' musics.txt

It didn’t work, then searching in the Internet I found this post:

Then the command became:

sed -i ':a;N;$!ba;s/\n\nCantor/\nCantor/g' musicas.txt

Now the order was restored.