Examples ======== This section provides practical examples for using fmus-vox. Simple Transcription -------------------- .. code-block:: python :caption: examples/simple_transcription.py from fmus_vox import transcribe # Transcribe an audio file audio_file = "recording.wav" text = transcribe(audio_file) print(f"Transcription: {text}") Text to Speech -------------- .. code-block:: python :caption: examples/text_to_speech.py from fmus_vox import Speaker # Create a speaker speaker = Speaker(voice="en-female-1") # Generate speech speaker.speak( "Hello! Welcome to fmus-vox.", output="welcome.wav" ) Voice Assistant --------------- .. code-block:: python :caption: examples/voice_assistant.py from fmus_vox import VoiceApp app = VoiceApp() @app.on_wake("hey assistant") def on_wake(): """Handle wake word detection.""" print("Assistant activated!") return True @app.on_transcribe def on_transcribe(text): """Handle user input.""" print(f"You said: {text}") # Simple command processing if "hello" in text.lower(): return "Hello! How can I help you?" elif "time" in text.lower(): from datetime import datetime return f"The time is {datetime.now().strftime('%H:%M')}" else: return "I didn't understand that." if __name__ == "__main__": app.run() For more examples, see the `examples/` directory in the repository.