Skip to main content

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.

Metadata

Release files for AudioProcessor 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for AudioProcessor 0.2.1
File Interpreter ABI Platform
AudioProcessor-0.2.1-py3-none-any.whl Python 3 none any Details

Release files / AudioProcessor-0.2.1-py3-none-any.whl

Download URL AudioProcessor-0.2.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
020e439dc99e88be2f8a30714875ef24328874b166aeae82412d2293e83a7ab7
BLAKE2b-256 checksum
How to use checksums
2de754e5b479d5f9f5327b85e51ba458d23a9e6c0e87d00f98c3badabc0cbd5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

1 release file

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page