Skip to main content

Voice Robotifier

This module contains an extremely simple class for recording audio, then playing it back using the text-to-speech program DECtalk.

Setup

Installation is made easy using pip:

pip install voice-robotifier

Example

import voice_robotifier

vr = voice_robotifier.VoiceRobotifier()

vr.set_voice_name('Harry')
vr.set_voice_rate(250) # words per minute

# optional: use different input/output devices than your current default
# vr.set_input_device('Microphone (C-Media USB Audio Device)')
# vr.set_output_device('CABLE Input (VB-Audio Virtual Cable)')

push_to_talk_key = 'v'
vr.start(push_to_talk_key)

Reference

VoiceRobotifier() -> VoiceRobotifier

Creates a new VoiceRobotifier instance.

VoiceRobotifier.start(key: Union[int, str], key_quit: Union[int, str] = 'esc', block: bool = True) -> Callable[None, None]

Starts the VoiceRobotifier in push-to-talk mode, where key is an int or str representing the desired push-to-talk key, and key_quit represents the key that should cause the thread to stop.

The operations of the method take place in a daemon thread, which the current thread will join on if block is True. If you want to carry out other program operations while it runs, set block to False.

Returns a function that stops the daemon thread when called. (This is really only useful when block is False, since otherwise the function will never return anything until an exception occurs.)

VoiceRobotifier.start_autodetect(energy_threshold: Union[float, None] = None, key_quit: Union[int, str] = 'esc', block: bool = True) -> Callable[None, None]

Starts the VoiceRobotifier in autodetect mode -- it will wait for the audio input to have a greater energy level than energy_threshold before processing it. This value should generally be from 150 to 3500 in most cases. If energy_threshold is None, the input device's current energy level will be sampled to auto-determine an energy level.

The key_quit and block arguments as well as the returned function act the same as those in VoiceRobotifier.start.

VoiceRobotifier.set_voice_name(voice_name: str) -> None

Sets the voice that should be used for generating text-to-speech audio. voice_name should be a name from the list returned by VoiceRobotifier.list_voices.

VoiceRobotifier.set_voice_rate(voice_rate: int) -> None

Sets the speed of the voice used for text-to-speech in words per minute. 200 is the default.

VoiceRobotifier.list_voice_names() -> List[str]

Returns a list of the names of all text-to-speech voices available through DECtalk. They can be passed as arguments to VoiceRobotifier.set_voice.

VoiceRobotifier.set_input_device(device_name: str) -> None

Sets the device used to get audio for speech recognition purposes. device_name should be a name from the list returned by VoiceRobotifier.list_device_names. If this method is never called on a VoiceRobotifier object, it will use the system's default input device.

VoiceRobotifier.set_output_device(device_name: str) -> None

Sets the device used to output the generated text-to-speech audio. device_name should be a name from the list returned by VoiceRobotifier.list_device_names. If this method is never called on a VoiceRobotifier object, it will use the system's default output device.

VoiceRobotifier.list_device_names() -> List[str]

Returns a list of device names on the system that can be passed as arguments to VoiceRobotifier.set_input_device and VoiceRobotifier.set_output_device

Download files

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

Source Distribution

voice_robotifier-1.1.tar.gz (514.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

voice_robotifier-1.1-py3-none-any.whl (511.3 kB view details)

Uploaded Python 3

File details

Details for the file voice_robotifier-1.1.tar.gz.

File metadata

  • Download URL: voice_robotifier-1.1.tar.gz
  • Upload date:
  • Size: 514.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for voice_robotifier-1.1.tar.gz
Algorithm Hash digest
SHA256 09dc702f453c83d0d468931f54d6ccd488c1776dbf7fca1e6dacabc8aab5fb7d
MD5 cbe6b46b18d1cf0f4e6c992073ef8526
BLAKE2b-256 a6c6ed6e4a22406e31791571a824352e34991a98e2bc89c8e350d821cea30a73

See more details on using hashes here.

File details

Details for the file voice_robotifier-1.1-py3-none-any.whl.

File metadata

  • Download URL: voice_robotifier-1.1-py3-none-any.whl
  • Upload date:
  • Size: 511.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for voice_robotifier-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 83b3f3d71cbe1dce1e11c054a0a9500176e0f65b3a304381b3b0e23083261bce
MD5 cb634ba90567f531fada64a58471327d
BLAKE2b-256 2f9daeda8158179516a644816312a74f663b64e674f2cbfdf0ab0595aa6b85d4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1 This release

2 files

1.0.3

2 files

1.0.2

2 files

1.0.1

2 files

1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page