diff --git a/.gitignore b/.gitignore index 7e99e36..bd3faf3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -*.pyc \ No newline at end of file +*.pyc +venv/ +text_to_speech/models \ No newline at end of file diff --git a/llm_translator.py b/llm_translator.py index 48ad039..89b94a3 100644 --- a/llm_translator.py +++ b/llm_translator.py @@ -29,9 +29,6 @@ def translator_de_fr(query): return translate(MODEL, syspromts.TRANSLATOR_DE_FR + query) - - - if __name__ == "__main__": response = translator_de_en(test_content.TESTSENTENCE_DE_BROKER) print(json.dumps(response, indent=2)) diff --git a/main.py b/main.py new file mode 100644 index 0000000..e69de29 diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..e146d13 --- /dev/null +++ b/readme.md @@ -0,0 +1,6 @@ +# Prerequisites + +sudo apt install liblc3-tools + +use python3.9 +pip install piper-tts soundfile librosa \ No newline at end of file diff --git a/text_to_speech/piper_welcome.sh b/text_to_speech/piper_welcome.sh new file mode 100644 index 0000000..212e915 --- /dev/null +++ b/text_to_speech/piper_welcome.sh @@ -0,0 +1,6 @@ +SCRIPT_DIR=$(dirname "$(readlink -f "$BASH_SOURCE")") + +echo 'Welcome to the world of speech synthesis!' | piper \ + --model en_US-lessac-medium \ + --output_file $SCRIPT_DIR/welcome.wav \ + --download-dir $SCRIPT_DIR/models \ No newline at end of file diff --git a/text_to_speech/resample.py b/text_to_speech/resample.py new file mode 100644 index 0000000..623384b --- /dev/null +++ b/text_to_speech/resample.py @@ -0,0 +1,19 @@ +# resample .wave from 22.05 to 24kHz sampling rate + +import librosa +import soundfile as sf + + +def resample(): + # Load the original audio file + audio, rate = librosa.load('welcome.wav') + + # Convert the sample rate to 24 kHz + resampled_rate = int(rate * 24 / 22050) + resampled_audio = librosa.resample(audio, rate, resampled_rate) + + # Save the resampled audio as a new .wav file + sf.write('welcome_resampled.wav', resampled_audio, resampled_rate) + +if __name__ == "__main__": + resample() \ No newline at end of file diff --git a/text_to_speech/text_to_speech.py b/text_to_speech/text_to_speech.py new file mode 100644 index 0000000..e69de29