mulive 0.1.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. mulive-0.1.0rc1/LICENSE +201 -0
  2. mulive-0.1.0rc1/MANIFEST.in +10 -0
  3. mulive-0.1.0rc1/PKG-INFO +220 -0
  4. mulive-0.1.0rc1/README.md +181 -0
  5. mulive-0.1.0rc1/docs/assets/mulive-hero.png +0 -0
  6. mulive-0.1.0rc1/mulive/__init__.py +15 -0
  7. mulive-0.1.0rc1/mulive/_resources.py +9 -0
  8. mulive-0.1.0rc1/mulive/apps/__init__.py +5 -0
  9. mulive-0.1.0rc1/mulive/apps/app_config.py +88 -0
  10. mulive-0.1.0rc1/mulive/apps/app_output.py +61 -0
  11. mulive-0.1.0rc1/mulive/apps/config_merge.py +118 -0
  12. mulive-0.1.0rc1/mulive/apps/effects.py +140 -0
  13. mulive-0.1.0rc1/mulive/apps/events.py +21 -0
  14. mulive-0.1.0rc1/mulive/apps/loader.py +239 -0
  15. mulive-0.1.0rc1/mulive/apps/prompts.py +115 -0
  16. mulive-0.1.0rc1/mulive/apps/qa.py +103 -0
  17. mulive-0.1.0rc1/mulive/apps/registry.py +122 -0
  18. mulive-0.1.0rc1/mulive/apps/routes.py +84 -0
  19. mulive-0.1.0rc1/mulive/apps/run_apps.py +146 -0
  20. mulive-0.1.0rc1/mulive/apps/show_config.py +111 -0
  21. mulive-0.1.0rc1/mulive/client/assets/mic-off.svg +4 -0
  22. mulive-0.1.0rc1/mulive/client/assets/mic-on.svg +4 -0
  23. mulive-0.1.0rc1/mulive/client/client.html +103 -0
  24. mulive-0.1.0rc1/mulive/client/css/dashboard.css +163 -0
  25. mulive-0.1.0rc1/mulive/client/css/session.css +642 -0
  26. mulive-0.1.0rc1/mulive/client/dashboard.html +31 -0
  27. mulive-0.1.0rc1/mulive/client/embed/mulive.js +222 -0
  28. mulive-0.1.0rc1/mulive/client/embed/pcm-player-worklet.js +110 -0
  29. mulive-0.1.0rc1/mulive/client/embed/pcm-worklet.js +10 -0
  30. mulive-0.1.0rc1/mulive/client/js/dashboard.js +55 -0
  31. mulive-0.1.0rc1/mulive/client/js/interaction.js +36 -0
  32. mulive-0.1.0rc1/mulive/client/js/mediaControls.js +131 -0
  33. mulive-0.1.0rc1/mulive/client/js/sessionApp.js +206 -0
  34. mulive-0.1.0rc1/mulive/client/js/trackManager.js +193 -0
  35. mulive-0.1.0rc1/mulive/client/js/transcriptView.js +27 -0
  36. mulive-0.1.0rc1/mulive/client/js/userSelector.js +62 -0
  37. mulive-0.1.0rc1/mulive/client/login.html +36 -0
  38. mulive-0.1.0rc1/mulive/client/websocket/app.js +38 -0
  39. mulive-0.1.0rc1/mulive/client/websocket/client.html +32 -0
  40. mulive-0.1.0rc1/mulive/client/websocket/style.css +178 -0
  41. mulive-0.1.0rc1/mulive/client/websocket/text_transport.js +30 -0
  42. mulive-0.1.0rc1/mulive/client/websocket/ui.js +41 -0
  43. mulive-0.1.0rc1/mulive/core/__init__.py +0 -0
  44. mulive-0.1.0rc1/mulive/core/async_controller_flow.py +181 -0
  45. mulive-0.1.0rc1/mulive/core/audio_input.py +79 -0
  46. mulive-0.1.0rc1/mulive/core/audio_output.py +65 -0
  47. mulive-0.1.0rc1/mulive/core/audio_utils.py +45 -0
  48. mulive-0.1.0rc1/mulive/core/auth.py +241 -0
  49. mulive-0.1.0rc1/mulive/core/controller_flow.py +117 -0
  50. mulive-0.1.0rc1/mulive/core/embed_stt_tts.py +188 -0
  51. mulive-0.1.0rc1/mulive/core/events.py +23 -0
  52. mulive-0.1.0rc1/mulive/core/llm_utils.py +393 -0
  53. mulive-0.1.0rc1/mulive/core/logging_utils.py +39 -0
  54. mulive-0.1.0rc1/mulive/core/multimodal_pipeline.py +122 -0
  55. mulive-0.1.0rc1/mulive/core/pipeline_helpers.py +157 -0
  56. mulive-0.1.0rc1/mulive/core/runtime_paths.py +34 -0
  57. mulive-0.1.0rc1/mulive/core/server_config.py +54 -0
  58. mulive-0.1.0rc1/mulive/core/session.py +54 -0
  59. mulive-0.1.0rc1/mulive/core/stream_dsl.py +396 -0
  60. mulive-0.1.0rc1/mulive/core/stt/__init__.py +7 -0
  61. mulive-0.1.0rc1/mulive/core/stt/deepgram.py +135 -0
  62. mulive-0.1.0rc1/mulive/core/stt/mlx.py +59 -0
  63. mulive-0.1.0rc1/mulive/core/stt/pinned.py +87 -0
  64. mulive-0.1.0rc1/mulive/core/stt/whisper.py +239 -0
  65. mulive-0.1.0rc1/mulive/core/token_signing.py +26 -0
  66. mulive-0.1.0rc1/mulive/core/transcribed_conversation.py +118 -0
  67. mulive-0.1.0rc1/mulive/core/tts_providers/__init__.py +19 -0
  68. mulive-0.1.0rc1/mulive/core/tts_providers/factory.py +59 -0
  69. mulive-0.1.0rc1/mulive/core/tts_providers/gemini.py +117 -0
  70. mulive-0.1.0rc1/mulive/core/tts_providers/kokoro_fastapi.py +188 -0
  71. mulive-0.1.0rc1/mulive/core/tts_providers/kokoro_onnx.py +264 -0
  72. mulive-0.1.0rc1/mulive/core/tts_providers/piper.py +324 -0
  73. mulive-0.1.0rc1/mulive/core/tts_providers/sink.py +126 -0
  74. mulive-0.1.0rc1/mulive/core/turn_source.py +194 -0
  75. mulive-0.1.0rc1/mulive/core/turndet.py +354 -0
  76. mulive-0.1.0rc1/mulive/core/user_profiles.py +85 -0
  77. mulive-0.1.0rc1/mulive/core/utils.py +33 -0
  78. mulive-0.1.0rc1/mulive/core/voice_engine.py +71 -0
  79. mulive-0.1.0rc1/mulive/core/webrtc_audio.py +111 -0
  80. mulive-0.1.0rc1/mulive/core/websocket_audio.py +82 -0
  81. mulive-0.1.0rc1/mulive/core/ws_voice_protocols.py +423 -0
  82. mulive-0.1.0rc1/mulive/quickstart/__init__.py +1 -0
  83. mulive-0.1.0rc1/mulive/quickstart/embed/__init__.py +1 -0
  84. mulive-0.1.0rc1/mulive/quickstart/embed/app.js +126 -0
  85. mulive-0.1.0rc1/mulive/quickstart/embed/app.py +36 -0
  86. mulive-0.1.0rc1/mulive/quickstart/embed/config.example.yml +13 -0
  87. mulive-0.1.0rc1/mulive/quickstart/embed/config.yml +11 -0
  88. mulive-0.1.0rc1/mulive/quickstart/embed/index.html +110 -0
  89. mulive-0.1.0rc1/mulive/quickstart/embed/style.css +273 -0
  90. mulive-0.1.0rc1/mulive/quickstart/mic.py +364 -0
  91. mulive-0.1.0rc1/mulive/quickstart/multimodal_agent.py +262 -0
  92. mulive-0.1.0rc1/mulive/quickstart/prompts.yml +49 -0
  93. mulive-0.1.0rc1/mulive/quickstart/web.py +73 -0
  94. mulive-0.1.0rc1/mulive/server/__init__.py +2 -0
  95. mulive-0.1.0rc1/mulive/server/fastapi_voice_ws_transport.py +109 -0
  96. mulive-0.1.0rc1/mulive/server/server_asyncio.py +167 -0
  97. mulive-0.1.0rc1/mulive/server/server_fastapi_embed.py +54 -0
  98. mulive-0.1.0rc1/mulive/server/server_fastapi_webrtc.py +178 -0
  99. mulive-0.1.0rc1/mulive/server/server_fastapi_ws.py +96 -0
  100. mulive-0.1.0rc1/mulive/server/setup_tracks.py +227 -0
  101. mulive-0.1.0rc1/mulive.egg-info/PKG-INFO +220 -0
  102. mulive-0.1.0rc1/mulive.egg-info/SOURCES.txt +105 -0
  103. mulive-0.1.0rc1/mulive.egg-info/dependency_links.txt +1 -0
  104. mulive-0.1.0rc1/mulive.egg-info/requires.txt +34 -0
  105. mulive-0.1.0rc1/mulive.egg-info/top_level.txt +1 -0
  106. mulive-0.1.0rc1/pyproject.toml +53 -0
  107. mulive-0.1.0rc1/setup.cfg +4 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,10 @@
1
+ include docs/assets/mulive-hero.png
2
+
3
+ prune .agents
4
+ prune .codex
5
+ prune archive
6
+ prune data
7
+ prune ext
8
+ prune muapps
9
+ prune tests
10
+ prune tmp
@@ -0,0 +1,220 @@
1
+ Metadata-Version: 2.4
2
+ Name: mulive
3
+ Version: 0.1.0rc1
4
+ Summary: Local-first, interactive voice and multimodal applications in Python
5
+ Author: Mulive contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/ekshaks/mulive
8
+ Project-URL: Repository, https://github.com/ekshaks/mulive
9
+ Project-URL: Issues, https://github.com/ekshaks/mulive/issues
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: aiohttp>=3.9
14
+ Requires-Dist: aiortc>=1.9
15
+ Requires-Dist: faster-whisper>=1.0
16
+ Requires-Dist: numpy>=1.26
17
+ Requires-Dist: onnxruntime>=1.17
18
+ Requires-Dist: Pillow>=10
19
+ Requires-Dist: piper-tts>=1.2
20
+ Requires-Dist: PyYAML>=6
21
+ Requires-Dist: reactivex>=4
22
+ Provides-Extra: fastapi
23
+ Requires-Dist: fastapi>=0.115; extra == "fastapi"
24
+ Requires-Dist: uvicorn>=0.30; extra == "fastapi"
25
+ Provides-Extra: mlx
26
+ Requires-Dist: mlx-whisper; (platform_system == "Darwin" and platform_machine == "arm64") and extra == "mlx"
27
+ Provides-Extra: groq
28
+ Requires-Dist: groq; extra == "groq"
29
+ Provides-Extra: openai
30
+ Requires-Dist: openai; extra == "openai"
31
+ Provides-Extra: gemini
32
+ Requires-Dist: google-genai; extra == "gemini"
33
+ Provides-Extra: kokoro
34
+ Requires-Dist: kokoro-onnx; extra == "kokoro"
35
+ Provides-Extra: local-audio
36
+ Requires-Dist: sounddevice; extra == "local-audio"
37
+ Requires-Dist: pywebrtc-audio; extra == "local-audio"
38
+ Dynamic: license-file
39
+
40
+ <p align="center">
41
+ <img src="https://raw.githubusercontent.com/ekshaks/mulive/main/docs/assets/mulive-hero.png" alt="Mulive: a Python voice application connected to a live browser interface and latency trace" width="1280" />
42
+ </p>
43
+
44
+ # Mulive
45
+
46
+ **Build local-first, interactive voice and multimodal applications in Python.**
47
+
48
+ Mulive is a lightweight real-time substrate that connects microphone, camera,
49
+ models, application state, and web UI. Build a tiny voice interaction first,
50
+ then grow it into a full product without replacing the runtime underneath.
51
+
52
+ > Voice is an interface to your application—not the application itself.
53
+
54
+ ## Why Mulive
55
+
56
+ - **Build applications, not just chatbots.** Voice can operate a game, tutor,
57
+ workflow, dashboard, or custom web UI.
58
+ - **Keep product logic explicit.** Voice, video, UI actions, and model results
59
+ can be handled as typed events with deterministic state transitions.
60
+ - **Run close to the product.** Use direct WebRTC and local-capable STT/TTS;
61
+ choose cloud models only where they add value.
62
+ - **Make interactions testable.** Test a single turn or a complete interaction,
63
+ including interruption, cancellation, and application outcomes.
64
+
65
+ ## Start with a voice interaction
66
+
67
+ ```bash
68
+ pip install mulive
69
+
70
+ # Browser audio + local voice stack
71
+ python -m mulive.quickstart.web --http --tts-browser
72
+ ```
73
+
74
+ Open `http://localhost:9000` and start streaming. `localhost` is trusted by
75
+ modern browsers, so microphone access works without a certificate.
76
+ The browser sends real-time media to Python and receives text and audio
77
+ responses.
78
+
79
+ An audio-only browser pipeline is just a few composed stages:
80
+
81
+ ```python
82
+ audio = Stream.source(session.audio_input, name="audio")
83
+ turn = audio | turn_detector()
84
+ transcripts = turn.segments | stt(provider="faster_whisper", model_size="tiny")
85
+ user_text = transcripts | final_transcript_text()
86
+
87
+ add_text_sinks(user_text, session, role="user", subs=subs)
88
+ add_tts(user_text, session.audio_output, turn.signals, subs=subs)
89
+ ```
90
+
91
+ Run the complete version with:
92
+
93
+ ```bash
94
+ python -m mulive.quickstart.web --http --tts-browser
95
+ ```
96
+
97
+ ## Choose a server setup
98
+
99
+ Use one of these public paths:
100
+
101
+ 1. **Standalone browser app.** Run the WebRTC quickstart above for a complete
102
+ browser client, signaling server, and local voice pipeline.
103
+ 2. **Existing FastAPI app.** Mount voice into an app you already own:
104
+
105
+ ```bash
106
+ pip install "mulive[fastapi]"
107
+ ```
108
+
109
+ ```python
110
+ from fastapi import FastAPI
111
+ from mulive import mount_voice
112
+
113
+ app = FastAPI()
114
+ mount_voice(app)
115
+ ```
116
+
117
+ Mulive serves its small browser client and its voice WebSocket transport.
118
+ There is no separate WebSocket server setup to choose.
119
+
120
+ ## Default voice stack
121
+
122
+ Mulive includes portable local defaults: Faster-Whisper for speech recognition
123
+ and Piper for speech output. They run on CPU and download their selected model
124
+ weights on first use.
125
+
126
+ STT alternatives include MLX on Apple Silicon and cloud providers. TTS
127
+ alternatives include in-process Kokoro ONNX (downloaded and cached on first
128
+ use) or an external Kokoro-FastAPI server.
129
+
130
+ ### HTTPS for another device or deployment
131
+
132
+ Use HTTP only when the browser and Mulive run on the same machine. For a phone,
133
+ LAN host, public hostname, or an HTTPS app embedding Mulive, serve it over
134
+ HTTPS. For local device testing, create a trusted development certificate with
135
+ [`mkcert`](https://github.com/FiloSottile/mkcert):
136
+
137
+ ```bash
138
+ mkcert -install
139
+ mkdir -p ~/.config/mulive/certs
140
+ mkcert -key-file ~/.config/mulive/certs/key.pem \
141
+ -cert-file ~/.config/mulive/certs/cert.pem \
142
+ localhost 127.0.0.1 ::1 <your-lan-hostname-or-ip>
143
+
144
+ python -m mulive.quickstart.web --tts-browser
145
+ ```
146
+
147
+ For production, terminate TLS with the deployment platform or reverse proxy and
148
+ set `MULIVE_SSL_KEYFILE` and `MULIVE_SSL_CERTFILE` when Mulive should serve TLS
149
+ itself.
150
+
151
+ ## What you can build
152
+
153
+ | Example | What it demonstrates | Status |
154
+ | --- | --- | --- |
155
+ | [Microphone loop](quickstart/mic.py) | Local microphone, turn detection, STT, and optional TTS | Available |
156
+ | [Browser audio](quickstart/web.py) | WebRTC audio, transcripts, and browser audio output | Available |
157
+ | [Math helper](quickstart/multimodal_agent.py) | Browser audio/video, latest-frame vision, and spoken responses | Experimental |
158
+ | Audio todo app | Voice-driven UI state and actions | Planned |
159
+ | Market voice dashboard | Voice control plus live visual data | Planned |
160
+ | Card-cancellation flow | Guarded voice workflow with explicit confirmation | Planned |
161
+
162
+ ## The application model
163
+
164
+ Mulive separates the parts that benefit from models from the parts your product
165
+ must control:
166
+
167
+ ```text
168
+ mic / camera / browser UI
169
+
170
+ streams and typed events
171
+
172
+ model calls + explicit app state
173
+
174
+ speech, UI updates, and safe effects
175
+ ```
176
+
177
+ Use models for perception and conversation. Keep scoring, workflow state,
178
+ permissions, retries, and external effects in normal application code. That is
179
+ especially useful for tutoring, games, customer workflows, and any interaction
180
+ where an answer must be checked before the app moves on.
181
+
182
+ ## Model architectures
183
+
184
+ Today, Mulive's examples use a cascaded pipeline:
185
+
186
+ ```text
187
+ audio → turn detection → STT → LLM/VLM → TTS
188
+ ```
189
+
190
+ The same application model is intended to support direct streaming
191
+ speech-to-speech models as they are added. The product state and UI should not
192
+ need to change just because the voice model does.
193
+
194
+ ## What is next
195
+
196
+ | Capability | Direction |
197
+ | --- | --- |
198
+ | Embeddable web voice | A small browser client and stable server integration for existing web apps |
199
+ | Backend TTS | Stream generated speech from a Python service without the browser UI |
200
+ | Systematic evaluation | Turn-level assertions and end-to-end interaction scenarios |
201
+ | Latency explorer | Per-turn timing from speech end through playback |
202
+ | Streaming voice models | Direct speech-to-speech and hybrid model adapters |
203
+
204
+ ## Project structure
205
+
206
+ ```text
207
+ mulive/ Runtime, browser assets, and runnable quickstarts
208
+ mulive/core/ Real-time transport, streams, and media helpers
209
+ mulive/apps/ Application helpers
210
+ mulive/client/ Browser WebRTC client and UI
211
+ mulive/quickstart/ Small runnable applications
212
+ tests/ Pipeline, controller, transport, and application tests
213
+ docs/ Architecture and design notes
214
+ ```
215
+
216
+ ## Current status
217
+
218
+ Mulive is actively evolving. The available quickstarts are useful foundations;
219
+ the embed API, latency explorer, streaming-model adapters, and polished product
220
+ demos are intentionally marked as planned rather than presented as shipped.
@@ -0,0 +1,181 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/ekshaks/mulive/main/docs/assets/mulive-hero.png" alt="Mulive: a Python voice application connected to a live browser interface and latency trace" width="1280" />
3
+ </p>
4
+
5
+ # Mulive
6
+
7
+ **Build local-first, interactive voice and multimodal applications in Python.**
8
+
9
+ Mulive is a lightweight real-time substrate that connects microphone, camera,
10
+ models, application state, and web UI. Build a tiny voice interaction first,
11
+ then grow it into a full product without replacing the runtime underneath.
12
+
13
+ > Voice is an interface to your application—not the application itself.
14
+
15
+ ## Why Mulive
16
+
17
+ - **Build applications, not just chatbots.** Voice can operate a game, tutor,
18
+ workflow, dashboard, or custom web UI.
19
+ - **Keep product logic explicit.** Voice, video, UI actions, and model results
20
+ can be handled as typed events with deterministic state transitions.
21
+ - **Run close to the product.** Use direct WebRTC and local-capable STT/TTS;
22
+ choose cloud models only where they add value.
23
+ - **Make interactions testable.** Test a single turn or a complete interaction,
24
+ including interruption, cancellation, and application outcomes.
25
+
26
+ ## Start with a voice interaction
27
+
28
+ ```bash
29
+ pip install mulive
30
+
31
+ # Browser audio + local voice stack
32
+ python -m mulive.quickstart.web --http --tts-browser
33
+ ```
34
+
35
+ Open `http://localhost:9000` and start streaming. `localhost` is trusted by
36
+ modern browsers, so microphone access works without a certificate.
37
+ The browser sends real-time media to Python and receives text and audio
38
+ responses.
39
+
40
+ An audio-only browser pipeline is just a few composed stages:
41
+
42
+ ```python
43
+ audio = Stream.source(session.audio_input, name="audio")
44
+ turn = audio | turn_detector()
45
+ transcripts = turn.segments | stt(provider="faster_whisper", model_size="tiny")
46
+ user_text = transcripts | final_transcript_text()
47
+
48
+ add_text_sinks(user_text, session, role="user", subs=subs)
49
+ add_tts(user_text, session.audio_output, turn.signals, subs=subs)
50
+ ```
51
+
52
+ Run the complete version with:
53
+
54
+ ```bash
55
+ python -m mulive.quickstart.web --http --tts-browser
56
+ ```
57
+
58
+ ## Choose a server setup
59
+
60
+ Use one of these public paths:
61
+
62
+ 1. **Standalone browser app.** Run the WebRTC quickstart above for a complete
63
+ browser client, signaling server, and local voice pipeline.
64
+ 2. **Existing FastAPI app.** Mount voice into an app you already own:
65
+
66
+ ```bash
67
+ pip install "mulive[fastapi]"
68
+ ```
69
+
70
+ ```python
71
+ from fastapi import FastAPI
72
+ from mulive import mount_voice
73
+
74
+ app = FastAPI()
75
+ mount_voice(app)
76
+ ```
77
+
78
+ Mulive serves its small browser client and its voice WebSocket transport.
79
+ There is no separate WebSocket server setup to choose.
80
+
81
+ ## Default voice stack
82
+
83
+ Mulive includes portable local defaults: Faster-Whisper for speech recognition
84
+ and Piper for speech output. They run on CPU and download their selected model
85
+ weights on first use.
86
+
87
+ STT alternatives include MLX on Apple Silicon and cloud providers. TTS
88
+ alternatives include in-process Kokoro ONNX (downloaded and cached on first
89
+ use) or an external Kokoro-FastAPI server.
90
+
91
+ ### HTTPS for another device or deployment
92
+
93
+ Use HTTP only when the browser and Mulive run on the same machine. For a phone,
94
+ LAN host, public hostname, or an HTTPS app embedding Mulive, serve it over
95
+ HTTPS. For local device testing, create a trusted development certificate with
96
+ [`mkcert`](https://github.com/FiloSottile/mkcert):
97
+
98
+ ```bash
99
+ mkcert -install
100
+ mkdir -p ~/.config/mulive/certs
101
+ mkcert -key-file ~/.config/mulive/certs/key.pem \
102
+ -cert-file ~/.config/mulive/certs/cert.pem \
103
+ localhost 127.0.0.1 ::1 <your-lan-hostname-or-ip>
104
+
105
+ python -m mulive.quickstart.web --tts-browser
106
+ ```
107
+
108
+ For production, terminate TLS with the deployment platform or reverse proxy and
109
+ set `MULIVE_SSL_KEYFILE` and `MULIVE_SSL_CERTFILE` when Mulive should serve TLS
110
+ itself.
111
+
112
+ ## What you can build
113
+
114
+ | Example | What it demonstrates | Status |
115
+ | --- | --- | --- |
116
+ | [Microphone loop](quickstart/mic.py) | Local microphone, turn detection, STT, and optional TTS | Available |
117
+ | [Browser audio](quickstart/web.py) | WebRTC audio, transcripts, and browser audio output | Available |
118
+ | [Math helper](quickstart/multimodal_agent.py) | Browser audio/video, latest-frame vision, and spoken responses | Experimental |
119
+ | Audio todo app | Voice-driven UI state and actions | Planned |
120
+ | Market voice dashboard | Voice control plus live visual data | Planned |
121
+ | Card-cancellation flow | Guarded voice workflow with explicit confirmation | Planned |
122
+
123
+ ## The application model
124
+
125
+ Mulive separates the parts that benefit from models from the parts your product
126
+ must control:
127
+
128
+ ```text
129
+ mic / camera / browser UI
130
+
131
+ streams and typed events
132
+
133
+ model calls + explicit app state
134
+
135
+ speech, UI updates, and safe effects
136
+ ```
137
+
138
+ Use models for perception and conversation. Keep scoring, workflow state,
139
+ permissions, retries, and external effects in normal application code. That is
140
+ especially useful for tutoring, games, customer workflows, and any interaction
141
+ where an answer must be checked before the app moves on.
142
+
143
+ ## Model architectures
144
+
145
+ Today, Mulive's examples use a cascaded pipeline:
146
+
147
+ ```text
148
+ audio → turn detection → STT → LLM/VLM → TTS
149
+ ```
150
+
151
+ The same application model is intended to support direct streaming
152
+ speech-to-speech models as they are added. The product state and UI should not
153
+ need to change just because the voice model does.
154
+
155
+ ## What is next
156
+
157
+ | Capability | Direction |
158
+ | --- | --- |
159
+ | Embeddable web voice | A small browser client and stable server integration for existing web apps |
160
+ | Backend TTS | Stream generated speech from a Python service without the browser UI |
161
+ | Systematic evaluation | Turn-level assertions and end-to-end interaction scenarios |
162
+ | Latency explorer | Per-turn timing from speech end through playback |
163
+ | Streaming voice models | Direct speech-to-speech and hybrid model adapters |
164
+
165
+ ## Project structure
166
+
167
+ ```text
168
+ mulive/ Runtime, browser assets, and runnable quickstarts
169
+ mulive/core/ Real-time transport, streams, and media helpers
170
+ mulive/apps/ Application helpers
171
+ mulive/client/ Browser WebRTC client and UI
172
+ mulive/quickstart/ Small runnable applications
173
+ tests/ Pipeline, controller, transport, and application tests
174
+ docs/ Architecture and design notes
175
+ ```
176
+
177
+ ## Current status
178
+
179
+ Mulive is actively evolving. The available quickstarts are useful foundations;
180
+ the embed API, latency explorer, streaming-model adapters, and polished product
181
+ demos are intentionally marked as planned rather than presented as shipped.
@@ -0,0 +1,15 @@
1
+ """Public Mulive API."""
2
+
3
+ from typing import Any
4
+
5
+ __all__ = ["mount_voice"]
6
+
7
+
8
+ def mount_voice(*args: Any, **kwargs: Any):
9
+ """Mount Mulive voice handling into a FastAPI application.
10
+
11
+ FastAPI remains an optional dependency until this API is used.
12
+ """
13
+ from .server.server_fastapi_embed import mount_voice as _mount_voice
14
+
15
+ return _mount_voice(*args, **kwargs)
@@ -0,0 +1,9 @@
1
+ """Paths to read-only files bundled with the Mulive package."""
2
+
3
+ from importlib.resources import files
4
+ from pathlib import Path
5
+
6
+
7
+ def packaged_path(*parts: str) -> Path:
8
+ """Return a filesystem path for a bundled Mulive resource."""
9
+ return Path(files("mulive").joinpath(*parts))
@@ -0,0 +1,5 @@
1
+ """App bundle loading and multi-app hosting."""
2
+
3
+ from .registry import AppDefinition, AppRegistry
4
+
5
+ __all__ = ["AppDefinition", "AppRegistry"]