Skip to main content

Bangla Speech to Text & Text to Speech.

Project description

Bangla Speech-to-Text & Text-to-Speech 🎙️🔊

This project enables Bangla Speech-to-Text (STT) and Text-to-Speech (TTS) conversion. It utilizes advanced AI models to achieve accurate transcription and natural-sounding speech synthesis.

Technologies Used:

  • 🗣️ Speech-to-Text (STT): hishab/titu_stt_bn_fastconformer – A powerful ASR model optimized for Bangla.
  • 🔊 Text-to-Speech (TTS): gTTS – A Google Text-to-Speech library for generating natural Bangla speech.

Setup

pip install -q git+https://github.com/HSAkash/Bangla-Speech2Text2Speech.git

or

pip install bnsttts

How to use in code

Speech to text

from bnsttts.stt import STT
stt = STT()
response = stt.transcribe("data/stt/01.wav")
print(response[0])

Text to speech

from bnsttts.tts import TTS
tts = TTS()
tts.speak("আমি বাংলায় কথা বলতে পারি", "data/tts/output.mp3", lang="bn")

Run commands

Speech to text

bnsttts -s <audio_file_path>

Example

🎵 Listen to the sample audio: Click here

bnsttts --stt data/stt/01.wav
output:
শুন কে আমি শিশু সুলভ বোক আমি মিশ্রণ হিসেবে বর্ণ না করব তিনি প্রায়ই সময় ডিমেরে এক হাজার ডলার খরচ করতেন তিনি তার বন্ধুদের সামনে সম্পথের শো অফ করতেন তিনি প্রকাশ্যে এবং উচ্চ সরে তার সম্পদ নিয়ে বড়াই করতেন প্রায় সময় মাতাল অবস্থায় এই হোটেল থেকে বের হতেন একদিন তিনি আমার এক সহকর্মীর হাতে নগদ কয়েক হাজার ডলার দিয়ে বললেন রাস্তার পাশে গয়নার দোকানে যাও এবং আমার জন্য কয়েক ডলার মূল্যের এক হাজার একটি সোনার কয়েন কিনে আন এক ঘন্টা পর হাতে সোনার কয়েন নিয়ে প্রকৌশলী এবং তার বন্ধুরা প্রশান্ত

Text to Speech

bnsttts -t <text>

Example

bnsttts --tts "আমি বাংলায় কথা বলতে পারি" -o data/tts/output.mp3
output:

🎵 Listen to the sample output: Click here

Audio file saved at data/tts/output.mp3

Help command

bnsttts -h
Usage: bnsttts [OPTIONS] CONTENT

  A CLI tool to convert text to speech or speech to text.

  Args:
    content (str): audio file path or text
    output (str): Where text to audio file will be stored.
    lang (str): Language to speak in (e.g., en, bn)
    tts (bool): For text to speech.
    stt (bool): For speech to text.
    slow (bool): For slow speech.

  Returns:
    str: Path to the generated audio file or transcribe text.

Options:
  -o, --output TEXT  Where text to audio file will be stored.
  -l, --lang TEXT    Language to speak in (e.g., en, bn
  -t, --tts          For text to speech.
  -s, --stt          For speech to text.
  --slow             For slow speech.
  -h, --help         Show this message and exit.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bangla_speech2text2speech-0.0.1.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Bangla_Speech2Text2Speech-0.0.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file bangla_speech2text2speech-0.0.1.tar.gz.

File metadata

File hashes

Hashes for bangla_speech2text2speech-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1e0c430c8c9c9001dc7f33d0be74db0c2d59f3a611cfed6a6aa8d78196982185
MD5 681e18d52e04edb74e814347942fd03d
BLAKE2b-256 49b9baa4f198372d0996a54b337fbbfc05398fc928d5192a0c29ec33b9d6e157

See more details on using hashes here.

File details

Details for the file Bangla_Speech2Text2Speech-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for Bangla_Speech2Text2Speech-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0817d94cae9239d44c6d832ea5afcdc5e6e5241f9ce1df1f42d0294afb23bda4
MD5 ee296f14ece462632a9c3ade37b24ee9
BLAKE2b-256 a94e379b0b11e8d591365b64fadee873355ed7611f9226fc3d44351dc7401613

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page