Skip to main content

Chinese Text To Speech and Speech Recognition

Project description

parrots

parrots, Automatic Speech Recognition(ASR), Text-To-Speech(TTS) engine.

Install

brew install portaudio
pip3 install -r requirements.txt
  • pip3 install parrots
  • Or
git clone https://github.com/shibing624/parrots.git
cd parrots
python3 setup.py install

Demo

Official Demo: https://www.mulanai.com/product/asr/

Usage

ASR

example: examples/demo_asr.py

import os
import sys

sys.path.append('..')
from parrots import SpeechRecognition, Pinyin2Hanzi

pwd_path = os.path.abspath(os.path.dirname(__file__))

if __name__ == '__main__':
    m = SpeechRecognition()
    r = m.recognize_speech_from_file(os.path.join(pwd_path, 'tushuguan.wav'))
    print('[提示] 语音识别结果:', r)

    n = Pinyin2Hanzi()
    text = n.pinyin_2_hanzi(r)
    print('[提示] 语音转文字结果:', text)

output:

北京图书馆

TTS

example: examples/demo_tts.py

import sys

sys.path.append('..')
from parrots import TextToSpeech

if __name__ == '__main__':
    m = TextToSpeech()
    # say text
    m.speak('北京图书馆')

    # generate wav file to path
    m.synthesize('北京图书馆', output_wav_path='./out.wav')

output:

北京图书馆

Dataset

语音库

从SourceForge下载语音库syllables.zip,并解压到parrots/data目录下

wget https://sourceforge.net/projects/hantts/files/syllables.zip --no-check-certificate

录制新的语音库

  • 按阴平、阳平、上声、去声、轻声的顺序录下 mapping.json 里每一个音节的五个声调
  • 按开头字母(letter)分组, 将文件存在 ./recording/{letter}.wav下
  • 运行 python process.py {letter} 将{letter}.wav 完整的录音分成独立的拼音
  • 检查核对./pre文件夹中的拼音.wav后导入文件夹./syllables

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

parrots-0.1.7.tar.gz (14.1 MB view details)

Uploaded Source

File details

Details for the file parrots-0.1.7.tar.gz.

File metadata

  • Download URL: parrots-0.1.7.tar.gz
  • Upload date:
  • Size: 14.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.12.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.8

File hashes

Hashes for parrots-0.1.7.tar.gz
Algorithm Hash digest
SHA256 8fd261d45d34bfce85c7410888d8deacd48ef86ad84f0faca8635e00b7b46535
MD5 758d36deb8a4a6a6f370b2b9b7000eb9
BLAKE2b-256 36c41bd2a930a381933d9a7ff1a192a490ec053bee99fc422dee980ed630b484

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