A Python package for recording, transcribing, and converting audio
Project description
AudioProcessor
AudioProcessor is a Python library that provides a simple interface to perform various audio processing tasks such as recording, voice-to-text conversion, text-to-voice conversion, and audio playback.
Installation
To use AudioProcessor, make sure you have the following packages installed:
- pyaudio
- pydub
- pydub.effects
- speech_recognition
- webrtcvad
- gtts
You can install these packages using pip:
pip install pyaudio pydub speechrecognition webrtcvad gtts
Usage
To use AudioProcessor, simply import the AudioProcessor
class and create an instance:
from audio_processor import AudioProcessor processor = AudioProcessor()
Recording audio
To record audio, use the record_audio
method:
processor.record_audio("output_file.wav")
This method records audio from the microphone and saves it to a .wav file.
Voice-to-text conversion
To convert an audio file to text, use the audio_to_text
method:
text = processor.audio_to_text("input_file.wav")
Text-to-voice conversion
To convert text to an audio file, use the text_to_audio
method:
processor.text_to_audio("Hello world!", "output_file.wav")
Audio playback
To play an audio file, use the play_audio_file
method:
processor.play_audio_file("input_file.wav")
Class Parameters
The AudioProcessor
class can be initialized with the following parameters:
frame_duration_ms
: (int) Frame duration in milliseconds for Voice Activity Detection (default: 30)sample_rate
: (int) Sample rate of the audio in Hz (default: 16000)chunk_size
: (int) Chunk size for audio playback (default: 1024)vad_mode
: (int) Voice Activity Detection mode, an integer between 0 and 3 (default: 2)log_level
: (int) Logging level, an integer between 0 and 50 (default: logging.WARNING)
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for AudioProcessor-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 020e439dc99e88be2f8a30714875ef24328874b166aeae82412d2293e83a7ab7 |
|
MD5 | 85d98f01646ec3c9a0200f9ba8c70919 |
|
BLAKE2b-256 | 2de754e5b479d5f9f5327b85e51ba458d23a9e6c0e87d00f98c3badabc0cbd5d |