A Python wrapper for A.I.VOICE Editor API that makes it easy to control A.I.VOICE Editor from Python.
✨ Easy to use: Simple Python interface for A.I.VOICE Editor API
🎵 Voice synthesis: Generate speech from text using A.I.VOICE voices
🔧 Full control: Access to all A.I.VOICE Editor functions
🛡️ Type safety: Full type hints for better development experience
- Windows OS
- A.I.VOICE Editor (v1.3.0 or later)
- Python 3.8+
- pythonnet
pip install aivoice-pythonimporttimefromaivoice_pythonimportAIVoiceTTsControl, HostStatus# Create A.I.VOICE controller (using default installation path)tts_control=AIVoiceTTsControl()
# Or specify custom installation path:# tts_control = AIVoiceTTsControl(editor_dir="C:\\MyPath\\AIVoice\\AIVoiceEditor\\")# Initialize APIhost_name=tts_control.get_available_host_names()[0]
tts_control.initialize(host_name)
# Start A.I.VOICE Editor if not runningiftts_control.status==HostStatus.NotRunning:
tts_control.start_host()
# Connect to A.I.VOICE Editortts_control.connect()
# Set text and playtts_control.text="Hello, A.I.VOICE!"play_time=tts_control.get_play_time()
tts_control.play()
# Wait for playback to completetime.sleep((play_time+500) /1000)
# Disconnecttts_control.disconnect()Main class for controlling A.I.VOICE Editor.
AIVoiceTTsControl(editor_dir: str = None)- Create controller instanceeditor_dir: Custom A.I.VOICE Editor installation path (optional)
text: str- Text to synthesizecurrent_voice_preset_name: str- Current voice preset namevoice_names: List[str]- Available voice namesvoice_preset_names: List[str]- Available voice preset namesstatus: HostStatus- Current host statusversion: str- Host version
initialize(service_name: str)- Initialize APIconnect()- Connect to A.I.VOICE Editordisconnect()- Disconnect from A.I.VOICE Editorstart_host()- Start A.I.VOICE Editorplay()- Start/pause playbackstop()- Stop playbackget_play_time() -> int- Get playback duration in millisecondssave_audio_to_file(path: str)- Save audio to file
NotRunning- A.I.VOICE Editor is not runningNotConnected- Not connected to A.I.VOICE EditorIdle- Connected and idleBusy- Connected and busy
Text- Text modeList- List mode
If A.I.VOICE Editor is installed in a non-standard location:
fromaivoice_pythonimportAIVoiceTTsControl# Specify custom installation pathtts_control=AIVoiceTTsControl(editor_dir="D:\\MyApps\\AIVoice\\AIVoiceEditor\\")
# ... rest of the code ...fromaivoice_pythonimportAIVoiceTTsControltts_control=AIVoiceTTsControl()
# ... initialization code ...tts_control.text="Hello, World!"tts_control.save_audio_to_file("output.wav")fromaivoice_pythonimportAIVoiceTTsControltts_control=AIVoiceTTsControl()
# ... initialization code ...# Get available voicesvoices=tts_control.voice_namesprint(f"Available voices: {voices}")
# Set voiceifvoices:
tts_control.current_voice_preset_name=voices[1] # Use second voicefromaivoice_pythonimportAIVoiceTTsControltry:
tts_control=AIVoiceTTsControl()
exceptFileNotFoundErrorase:
print(f"A.I.VOICE Editor not found: {e}")
# Try with custom pathtry:
tts_control=AIVoiceTTsControl(editor_dir="C:\\MyPath\\AIVoice\\AIVoiceEditor\\")
exceptFileNotFoundError:
print("Please install A.I.VOICE Editor v1.3.0 or later.")MIT License
Contributions are welcome! Please feel free to submit a Pull Request.
If you encounter any issues, please create an issue on the GitHub repository.