diff --git a/.gitignore b/.gitignore index 79c564f..0a54a88 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /models/* +!/input/demo.wav +/input/converted_to_wav/*.wav /output/*.txt /output/*.csv diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..e393d9f --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/transcription-vosk.iml b/.idea/transcription-vosk.iml new file mode 100644 index 0000000..c358824 --- /dev/null +++ b/.idea/transcription-vosk.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Makefile b/Makefile index b5c11e8..380c06f 100644 --- a/Makefile +++ b/Makefile @@ -2,4 +2,4 @@ default: install install: bash install.sh convert: - bash convert_from_wav.sh $1 + bash convert_from_wav.sh $(args) diff --git a/README.md b/README.md index e5a8708..adc5bee 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ configuration pour transcrire des fichiers audio wav avec Vosk git clone https://forge.chapril.org/tykayn/transcription.git && cd transcription ``` -* installer vosk via le MakeFile, nécessite python3 pip. faites la commande: +* installer vosk via le MakeFile, nécessite python3 pip. une fois dans votre dossier de transcription fraîchement cloné, faites la commande: ``` make ``` @@ -23,8 +23,11 @@ make * le convertir en wav mono (avec audacity par exemple) * lancer la transcription du wav mono. Une démo est disponible, extraite de l'émission Libre à vous! ``` -make convert input/demo.wav +make convert file=input/demo.wav ``` +n'oubliez pas l'argument `file=` + + * la sortie texte de la transcription se trouve dans output `output/converted_out_without_nulls.txt` et devrait être affichée à la fin de l'exécution du script. # Précisions @@ -45,9 +48,3 @@ make convert input/demo.wav * site officiel de [Vosk : installation](https://alphacephei.com/vosk/install) , [modèles de langue](https://alphacephei.com/vosk/models) * [site cipherbliss.com](https://www.cipherbliss.com/) * [@tykayn](https://mastodon.cipherbliss.com/@tykayn) sur Mastodon. - - - - - - diff --git a/convert_from_wav.sh b/convert_from_wav.sh index 6109d53..81d2ddc 100644 --- a/convert_from_wav.sh +++ b/convert_from_wav.sh @@ -2,30 +2,25 @@ # utilisation: bash convert_from_wav.sh MONFICHIER.wav # auteur du script: tykayn contact@cipherbliss.com -echo "########### 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." echo " " -# if [-f $1] -# echo " fichier non trouvé: $1" -# ls -larth input -# exit 1 -# fi -python3 ./conversion_simple_fr.py $1 > output/converted_output.txt +echo "########### $(date) : fichier : $file" +echo " " +python3 ./conversion_simple_fr.py "$file" > output/converted_output.txt echo " " -echo "########### nettoyer la sortie " -echo " " +echo "########### $(date) : nettoyer la sortie " jq .text output/converted_output.txt > output/converted_cleaned_with_null.txt sed 's/null//g' output/converted_cleaned_with_null.txt > output/converted_out_without_nulls.txt sed 's/^ *//; s/ *$//; /^$/d' output/converted_out_without_nulls.txt > output/converted_out_without_nulls2.txt sed 's/\"//g' output/converted_out_without_nulls2.txt > output/converted_out_without_nulls3.txt - -echo " " -echo "########### OK " +echo "########### $(date) : OK " echo " " COUNT_LINES=$(cat output/converted_out_without_nulls3.txt |wc -l) - -echo "########### lignes transcriptes $COUNT_LINES " -echo "########### conversion faite dans output/converted_out_without_nulls.txt" +cat output/converted_out_without_nulls.txt +echo " " +echo "########### $(date) : lignes transcriptes $COUNT_LINES " +echo "########### $(date) : conversion faite dans output/converted_out_without_nulls.txt" exit 0 diff --git a/input/converted_to_wav/.gitkeep b/input/converted_to_wav/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/ogg_to_wav.sh b/ogg_to_wav.sh new file mode 100644 index 0000000..52291ec --- /dev/null +++ b/ogg_to_wav.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# utilisation: bash convert_from_wav.sh MONFICHIER.wav +# auteur du script: tykayn contact@cipherbliss.com + +echo "########### conversion des fichiers audio .ogg dans le dossier input, vers du wav mono-piste uniquement, + avec Vosk installé par pip3, et un modèle de textes en français." +echo " " +for i in input/*.ogg; do + ffmpeg -acodec libvorbis -i "$i" -acodec pcm_s16le "input/converted_to_wav/${i%ogg}wav" +done + +echo " " +echo "########### OK " +echo " " +COUNT_LINES_OGG=$(ll input/*.ogg |wc -l) +COUNT_LINES=$(ll input/converted_to_wav |wc -l) + +echo "########### fichiers ogg dans le dossier input: $COUNT_LINES_OGG " +echo "########### fichiers wav dans le dossier input: $COUNT_LINES " +echo "########### conversion faite dans output/converted_out_without_nulls.txt" +exit 0