musicflow-studioai 1.0.0__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.
- musicflow_studioai-1.0.0/LICENSE +21 -0
- musicflow_studioai-1.0.0/PKG-INFO +66 -0
- musicflow_studioai-1.0.0/README.md +43 -0
- musicflow_studioai-1.0.0/musicflow/__init__.py +74 -0
- musicflow_studioai-1.0.0/musicflow_studioai.egg-info/PKG-INFO +66 -0
- musicflow_studioai-1.0.0/musicflow_studioai.egg-info/SOURCES.txt +9 -0
- musicflow_studioai-1.0.0/musicflow_studioai.egg-info/dependency_links.txt +1 -0
- musicflow_studioai-1.0.0/musicflow_studioai.egg-info/requires.txt +1 -0
- musicflow_studioai-1.0.0/musicflow_studioai.egg-info/top_level.txt +1 -0
- musicflow_studioai-1.0.0/pyproject.toml +31 -0
- musicflow_studioai-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MusicFlow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: musicflow-studioai
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AI adaptive game music & generation SDK for MusicFlow.
|
|
5
|
+
Author-email: MusicFlow <hello@musicflow.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://musicflow.io
|
|
8
|
+
Project-URL: Documentation, https://musicflow.io/dashboard/docs
|
|
9
|
+
Keywords: music,ai,game,adaptive,soundtrack,musicflow,generation
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: requests>=2.25
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# musicflow-studioai (Python SDK)
|
|
25
|
+
|
|
26
|
+
AI adaptive game music & generation for Python backends and tools.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
```bash
|
|
30
|
+
pip install musicflow-studioai
|
|
31
|
+
# or from the downloaded archive:
|
|
32
|
+
pip install ./musicflow-studioai.tar.gz
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
```python
|
|
37
|
+
from musicflow import MusicFlow
|
|
38
|
+
|
|
39
|
+
mf = MusicFlow("mf_live_xxx")
|
|
40
|
+
|
|
41
|
+
# Generate and wait for completion
|
|
42
|
+
track = mf.generate("epic boss battle", genre="Orchestral", duration=60, loop=True)
|
|
43
|
+
print(track["audio_files"]["mp3"], track["metadata"]["bpm"])
|
|
44
|
+
|
|
45
|
+
# Adaptive session
|
|
46
|
+
mf.adaptive.create_session(game="Neon Drift", mood="dark")
|
|
47
|
+
mf.adaptive.set_intensity(0.8)
|
|
48
|
+
mf.adaptive.transition("boss")
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
MIT
|
|
53
|
+
|
|
54
|
+
## Publishing (maintainers)
|
|
55
|
+
```bash
|
|
56
|
+
pip install build twine
|
|
57
|
+
python -m build # builds dist/*.tar.gz and dist/*.whl
|
|
58
|
+
twine check dist/* # validates metadata (should PASS)
|
|
59
|
+
# 1) TestPyPI first (token from https://test.pypi.org/manage/account/token/)
|
|
60
|
+
TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-... twine upload --repository testpypi dist/*
|
|
61
|
+
pip install --index-url https://test.pypi.org/simple/ --no-deps musicflow-studioai
|
|
62
|
+
# 2) then PyPI (token from https://pypi.org/manage/account/token/)
|
|
63
|
+
TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-... twine upload dist/*
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Docs: https://musicflow.io/dashboard/docs
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# musicflow-studioai (Python SDK)
|
|
2
|
+
|
|
3
|
+
AI adaptive game music & generation for Python backends and tools.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
```bash
|
|
7
|
+
pip install musicflow-studioai
|
|
8
|
+
# or from the downloaded archive:
|
|
9
|
+
pip install ./musicflow-studioai.tar.gz
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
```python
|
|
14
|
+
from musicflow import MusicFlow
|
|
15
|
+
|
|
16
|
+
mf = MusicFlow("mf_live_xxx")
|
|
17
|
+
|
|
18
|
+
# Generate and wait for completion
|
|
19
|
+
track = mf.generate("epic boss battle", genre="Orchestral", duration=60, loop=True)
|
|
20
|
+
print(track["audio_files"]["mp3"], track["metadata"]["bpm"])
|
|
21
|
+
|
|
22
|
+
# Adaptive session
|
|
23
|
+
mf.adaptive.create_session(game="Neon Drift", mood="dark")
|
|
24
|
+
mf.adaptive.set_intensity(0.8)
|
|
25
|
+
mf.adaptive.transition("boss")
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
MIT
|
|
30
|
+
|
|
31
|
+
## Publishing (maintainers)
|
|
32
|
+
```bash
|
|
33
|
+
pip install build twine
|
|
34
|
+
python -m build # builds dist/*.tar.gz and dist/*.whl
|
|
35
|
+
twine check dist/* # validates metadata (should PASS)
|
|
36
|
+
# 1) TestPyPI first (token from https://test.pypi.org/manage/account/token/)
|
|
37
|
+
TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-... twine upload --repository testpypi dist/*
|
|
38
|
+
pip install --index-url https://test.pypi.org/simple/ --no-deps musicflow-studioai
|
|
39
|
+
# 2) then PyPI (token from https://pypi.org/manage/account/token/)
|
|
40
|
+
TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-... twine upload dist/*
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Docs: https://musicflow.io/dashboard/docs
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""MusicFlow Python SDK - client for the MusicFlow REST API."""
|
|
2
|
+
import time
|
|
3
|
+
import requests
|
|
4
|
+
|
|
5
|
+
__version__ = "1.0.0"
|
|
6
|
+
DEFAULT_BASE = "https://api.musicflow.io/v1"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class MusicFlowError(Exception):
|
|
10
|
+
pass
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Adaptive:
|
|
14
|
+
def __init__(self, client):
|
|
15
|
+
self._c = client
|
|
16
|
+
self.session_id = None
|
|
17
|
+
|
|
18
|
+
def create_session(self, game="Game", mood="cinematic"):
|
|
19
|
+
s = self._c._post("/adaptive/session", {"game_name": game, "mood": mood})
|
|
20
|
+
self.session_id = s["session_id"]
|
|
21
|
+
return s
|
|
22
|
+
|
|
23
|
+
def set_intensity(self, value):
|
|
24
|
+
return self._c._post("/adaptive/intensity", {"session_id": self.session_id, "intensity": value})
|
|
25
|
+
|
|
26
|
+
def transition(self, state):
|
|
27
|
+
return self._c._post("/adaptive/transition", {"session_id": self.session_id, "state": state})
|
|
28
|
+
|
|
29
|
+
def set_mood(self, mood):
|
|
30
|
+
return self._c._post("/adaptive/mood", {"session_id": self.session_id, "mood": mood})
|
|
31
|
+
|
|
32
|
+
def trigger_cue(self, name):
|
|
33
|
+
"""Trigger a cutscene cue by name -> {cue, mood, genre, audio_url}."""
|
|
34
|
+
return self._c._post("/adaptive/cue", {"session_id": self.session_id, "name": name})
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class MusicFlow:
|
|
38
|
+
def __init__(self, api_key, base_url=DEFAULT_BASE):
|
|
39
|
+
if not api_key:
|
|
40
|
+
raise MusicFlowError("api_key is required")
|
|
41
|
+
self.api_key = api_key
|
|
42
|
+
self.base = base_url
|
|
43
|
+
self.adaptive = Adaptive(self)
|
|
44
|
+
|
|
45
|
+
def _headers(self):
|
|
46
|
+
return {"Authorization": f"Bearer {self.api_key}"}
|
|
47
|
+
|
|
48
|
+
def _post(self, path, body=None):
|
|
49
|
+
r = requests.post(self.base + path, json=body or {}, headers=self._headers(), timeout=30)
|
|
50
|
+
if not r.ok:
|
|
51
|
+
raise MusicFlowError(f"{path} -> {r.status_code}")
|
|
52
|
+
return r.json()
|
|
53
|
+
|
|
54
|
+
def _get(self, path):
|
|
55
|
+
r = requests.get(self.base + path, headers=self._headers(), timeout=30)
|
|
56
|
+
if not r.ok:
|
|
57
|
+
raise MusicFlowError(f"{path} -> {r.status_code}")
|
|
58
|
+
return r.json()
|
|
59
|
+
|
|
60
|
+
def generate(self, prompt, poll_seconds=4, timeout_seconds=300, **params):
|
|
61
|
+
"""Generate a track and block until it is ready."""
|
|
62
|
+
created = self._post("/generations", {"prompt": prompt, **params})
|
|
63
|
+
start = time.time()
|
|
64
|
+
while time.time() - start < timeout_seconds:
|
|
65
|
+
g = self._get(f"/generations/{created['id']}")
|
|
66
|
+
if g["status"] == "completed":
|
|
67
|
+
return g
|
|
68
|
+
if g["status"] == "failed":
|
|
69
|
+
raise MusicFlowError("generation failed")
|
|
70
|
+
time.sleep(poll_seconds)
|
|
71
|
+
raise MusicFlowError("generation timed out")
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
__all__ = ["MusicFlow", "Adaptive", "MusicFlowError", "__version__"]
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: musicflow-studioai
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: AI adaptive game music & generation SDK for MusicFlow.
|
|
5
|
+
Author-email: MusicFlow <hello@musicflow.io>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://musicflow.io
|
|
8
|
+
Project-URL: Documentation, https://musicflow.io/dashboard/docs
|
|
9
|
+
Keywords: music,ai,game,adaptive,soundtrack,musicflow,generation
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: requests>=2.25
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# musicflow-studioai (Python SDK)
|
|
25
|
+
|
|
26
|
+
AI adaptive game music & generation for Python backends and tools.
|
|
27
|
+
|
|
28
|
+
## Install
|
|
29
|
+
```bash
|
|
30
|
+
pip install musicflow-studioai
|
|
31
|
+
# or from the downloaded archive:
|
|
32
|
+
pip install ./musicflow-studioai.tar.gz
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
```python
|
|
37
|
+
from musicflow import MusicFlow
|
|
38
|
+
|
|
39
|
+
mf = MusicFlow("mf_live_xxx")
|
|
40
|
+
|
|
41
|
+
# Generate and wait for completion
|
|
42
|
+
track = mf.generate("epic boss battle", genre="Orchestral", duration=60, loop=True)
|
|
43
|
+
print(track["audio_files"]["mp3"], track["metadata"]["bpm"])
|
|
44
|
+
|
|
45
|
+
# Adaptive session
|
|
46
|
+
mf.adaptive.create_session(game="Neon Drift", mood="dark")
|
|
47
|
+
mf.adaptive.set_intensity(0.8)
|
|
48
|
+
mf.adaptive.transition("boss")
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
MIT
|
|
53
|
+
|
|
54
|
+
## Publishing (maintainers)
|
|
55
|
+
```bash
|
|
56
|
+
pip install build twine
|
|
57
|
+
python -m build # builds dist/*.tar.gz and dist/*.whl
|
|
58
|
+
twine check dist/* # validates metadata (should PASS)
|
|
59
|
+
# 1) TestPyPI first (token from https://test.pypi.org/manage/account/token/)
|
|
60
|
+
TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-... twine upload --repository testpypi dist/*
|
|
61
|
+
pip install --index-url https://test.pypi.org/simple/ --no-deps musicflow-studioai
|
|
62
|
+
# 2) then PyPI (token from https://pypi.org/manage/account/token/)
|
|
63
|
+
TWINE_USERNAME=__token__ TWINE_PASSWORD=pypi-... twine upload dist/*
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Docs: https://musicflow.io/dashboard/docs
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
musicflow/__init__.py
|
|
5
|
+
musicflow_studioai.egg-info/PKG-INFO
|
|
6
|
+
musicflow_studioai.egg-info/SOURCES.txt
|
|
7
|
+
musicflow_studioai.egg-info/dependency_links.txt
|
|
8
|
+
musicflow_studioai.egg-info/requires.txt
|
|
9
|
+
musicflow_studioai.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.25
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
musicflow
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "musicflow-studioai"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "AI adaptive game music & generation SDK for MusicFlow."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.8"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "MusicFlow", email = "hello@musicflow.io" }]
|
|
13
|
+
keywords = ["music", "ai", "game", "adaptive", "soundtrack", "musicflow", "generation"]
|
|
14
|
+
dependencies = ["requests>=2.25"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.8",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://musicflow.io"
|
|
28
|
+
Documentation = "https://musicflow.io/dashboard/docs"
|
|
29
|
+
|
|
30
|
+
[tool.setuptools]
|
|
31
|
+
packages = ["musicflow"]
|