simple convert in en script

This commit is contained in:
Tykayn 2021-03-23 12:54:53 +01:00 committed by tykayn
parent 8d31bff32a
commit ed4d03342d
17 changed files with 11 additions and 83 deletions

View File

@ -6,9 +6,8 @@ import os
import wave import wave
SetLogLevel(0) SetLogLevel(0)
# print(" ------- conversion simple de", sys.argv[1])
if not os.path.exists("models/fr"): if not os.path.exists("models/en"):
print ("Please download the model from https://alphacephei.com/vosk/models and unpack as 'models' in the current folder.") print ("Please download the model from https://alphacephei.com/vosk/models and unpack as 'models' in the current folder.")
exit (1) exit (1)
@ -18,7 +17,7 @@ if wf.getnchannels() != 1 or wf.getsampwidth() != 2 or wf.getcomptype() != "NONE
print ("Audio file must be WAV format mono PCM.") print ("Audio file must be WAV format mono PCM.")
exit (1) exit (1)
model = Model("models/fr") model = Model("models/en")
rec = KaldiRecognizer(model, wf.getframerate()) rec = KaldiRecognizer(model, wf.getframerate())
while True: while True:

View File

@ -6,8 +6,6 @@ import os
import wave import wave
SetLogLevel(0) SetLogLevel(0)
print(" ------- conversion simple de", sys.argv[1])
if not os.path.exists("models/fr"): if not os.path.exists("models/fr"):
print ("Please download the model from https://alphacephei.com/vosk/models and unpack as 'models' in the current folder.") print ("Please download the model from https://alphacephei.com/vosk/models and unpack as 'models' in the current folder.")
exit (1) exit (1)

Binary file not shown.

View File

@ -1,12 +0,0 @@
{
"text" : ""
}
{
"text" : ""
}
{
"text" : ""
}
{
"text" : ""
}

View File

@ -1,4 +0,0 @@
""
""
""
""

View File

@ -1,4 +0,0 @@
""
""
""
""

View File

@ -1,4 +0,0 @@
""
""
""
""

View File

@ -1,4 +0,0 @@

Binary file not shown.

Binary file not shown.

View File

@ -1,44 +0,0 @@
{
"result" : [{
"conf" : 0.545601,
"end" : 0.120000,
"start" : 0.000000,
"word" : "les"
}, {
"conf" : 0.658098,
"end" : 0.600019,
"start" : 0.180000,
"word" : "fascistes"
}, {
"conf" : 0.911231,
"end" : 0.719916,
"start" : 0.660000,
"word" : "de"
}, {
"conf" : 0.885049,
"end" : 1.109087,
"start" : 0.719916,
"word" : "merde"
}, {
"conf" : 0.512951,
"end" : 1.530000,
"start" : 1.380000,
"word" : "un"
}, {
"conf" : 0.840160,
"end" : 2.430000,
"start" : 1.547196,
"word" : "fasciste"
}, {
"conf" : 0.992080,
"end" : 2.609995,
"start" : 2.490000,
"word" : "de"
}, {
"conf" : 0.994251,
"end" : 3.210000,
"start" : 2.609995,
"word" : "merde"
}],
"text" : "les fascistes de merde un fasciste de merde"
}

View File

@ -1 +0,0 @@
"les fascistes de merde un fasciste de merde"

View File

@ -1 +0,0 @@
"les fascistes de merde un fasciste de merde"

View File

@ -1 +0,0 @@
"les fascistes de merde un fasciste de merde"

View File

@ -1 +0,0 @@
les fascistes de merde un fasciste de merde

View File

@ -6,6 +6,14 @@ if [ $1 ]; then
file=$1 file=$1
fi fi
FILE_NAME=$(basename $file .wav)
output_dir="output"
if [ $2 ]; then
output_dir=$2
fi
OUT_DIR=$( echo "$output_dir/$FILE_NAME")
echo "########### $(date) : conversion de fichier audio .WAV mono piste uniquement, echo "########### $(date) : conversion de fichier audio .WAV mono piste uniquement,
avec Vosk installé par pip3, et un modèle de textes en français." avec Vosk installé par pip3, et un modèle de textes en français."
echo " " echo " "
@ -40,8 +48,7 @@ else
exit 1 exit 1
fi fi
echo " " echo " "
FILE_NAME=$(basename $file .wav)
OUT_DIR=$( echo "output/$FILE_NAME")
mkdir output/$FILE_NAME mkdir output/$FILE_NAME
echo " convertir en sous titre ? $ENABLE_SRT" echo " convertir en sous titre ? $ENABLE_SRT"
if ($ENABLE_SRT) ; then if ($ENABLE_SRT) ; then