Skip to main content

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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

AudioProcessor-0.2.1-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

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