A python wrapper for google speech to text api
Project description
easySpeech
easySpeech is an open source python wrapper for google speech to text api that doesn't require PyAaudio(So you specially windows user don't have to deal with the errors while installing PyAudio) and also works with hugging face transformers
Installation
You can install easySpeech very easily using the following command
pip3 install easySpeech
Usage
- Using google speech to text api
By default easySpeech comes with a default api key which you can for testing purposes using the following code.
from easySpeech import speech
a=speech.speech('google')
print(a)
For production purpose use your own key because google can revoke the default api key at any time. Get your own api key from http://www.chromium.org/developers/how-tos/api-keys and use the following code
from easySpeech import speech
a=speech.speech('google',key="your api key")
print(a)
Specifying the duration of speech recognition in seconds(default value is 5 seconds)
from easySpeech import speech
a=speech.speech('google',duration = 10)
print(a)
Specifying the sample frequency(default is 44100)
from easySpeech import speech
a=speech.speech('google',duration = 10,freq = 44100)
print(a)
Specifying the language(works only for google speech api and default is english)
from easySpeech import speech
a=speech.speech('google',language="en-US")
print(a)
Converting an audio file to text(Currently it supports only wav file)
from easySpeech import speech
a=speech.google_audio('recording.wav')
print(a)
- Using hugging face transformers(works offline and no need of any kind of api key) For using easySpeech with hugging face transformers use the following code.
from easySpeech import speech
a=speech.speech('ml')
print(a)
Specifying the duration of speech recognition in seconds(default valus is 5 seconds)
from easySpeech import speech
a=speech.speech('ml',duration = 10)
print(a)
Specifying the sample frequency(default is 44100)
from easySpeech import speech
a=speech.speech('ml',duration = 10,freq = 44100)
print(a)
Converting an audio file to text(Currently it supports only wav file)
from easySpeech import ml
a=ml.ml('recording.wav')
print(a)
- Recording audio
For recording audio use the following code
from easySpeech import speech
speech.recorder('recording.wav')
For recording audio with a specific frequency use the following code(default is 44100)
from easySpeech import speech
speech.recorder('recording.wav',freq = 50000)
For recording audio for a specific duration use the following code(default is 5s)
from easySpeech import speech
speech.recorder('recording.wav',duration = 50)
How to contribute
Since it is a free software , you can contribute to make it better. New contributors are always welcome, whether you write code, create resources, report bugs, or suggest features.
The easySpeech is written primarily in Python3x
Have a look at the open issues to find a mission that resonates with you.
Contact
Email: saptakbhoumik@gmail.com
If you find any bug make a issue immediately.
License
easySpeech is lisenced under MIT license
MIT License | Copyright (c) 2021 SaptakBhoumik
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software
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
File details
Details for the file easySpeech-1.0.2.tar.gz
.
File metadata
- Download URL: easySpeech-1.0.2.tar.gz
- Upload date:
- Size: 2.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0704204f4772736a992e5d01f7db7cafd24ccb4892562592948a0602a9fa431b |
|
MD5 | 63805e6d726b9c3c6a2680558e9eff4c |
|
BLAKE2b-256 | 4d8a91a3cf082ac4b476a6ee7a63f254f540a31eaafa531848a13fdd272ee39c |