mlx-audiogen 0.2.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.
Files changed (80) hide show
  1. mlx_audiogen-0.2.0/.gitignore +61 -0
  2. mlx_audiogen-0.2.0/LICENSE +190 -0
  3. mlx_audiogen-0.2.0/PKG-INFO +400 -0
  4. mlx_audiogen-0.2.0/README.md +354 -0
  5. mlx_audiogen-0.2.0/mlx_audiogen/__init__.py +8 -0
  6. mlx_audiogen-0.2.0/mlx_audiogen/__main__.py +4 -0
  7. mlx_audiogen-0.2.0/mlx_audiogen/cli/__init__.py +1 -0
  8. mlx_audiogen-0.2.0/mlx_audiogen/cli/convert.py +140 -0
  9. mlx_audiogen-0.2.0/mlx_audiogen/cli/generate.py +332 -0
  10. mlx_audiogen-0.2.0/mlx_audiogen/cli/train.py +226 -0
  11. mlx_audiogen-0.2.0/mlx_audiogen/credentials.py +90 -0
  12. mlx_audiogen-0.2.0/mlx_audiogen/library/__init__.py +1 -0
  13. mlx_audiogen-0.2.0/mlx_audiogen/library/cache.py +379 -0
  14. mlx_audiogen-0.2.0/mlx_audiogen/library/cloud_paths.py +93 -0
  15. mlx_audiogen-0.2.0/mlx_audiogen/library/collections.py +254 -0
  16. mlx_audiogen-0.2.0/mlx_audiogen/library/description_gen.py +158 -0
  17. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/__init__.py +6 -0
  18. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/clients.py +15 -0
  19. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/discogs.py +88 -0
  20. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/enrichment_db.py +262 -0
  21. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/lastfm.py +99 -0
  22. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/manager.py +177 -0
  23. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/musicbrainz.py +90 -0
  24. mlx_audiogen-0.2.0/mlx_audiogen/library/enrichment/rate_limiter.py +41 -0
  25. mlx_audiogen-0.2.0/mlx_audiogen/library/models.py +169 -0
  26. mlx_audiogen-0.2.0/mlx_audiogen/library/parsers.py +282 -0
  27. mlx_audiogen-0.2.0/mlx_audiogen/library/taste/__init__.py +1 -0
  28. mlx_audiogen-0.2.0/mlx_audiogen/library/taste/engine.py +166 -0
  29. mlx_audiogen-0.2.0/mlx_audiogen/library/taste/profile.py +158 -0
  30. mlx_audiogen-0.2.0/mlx_audiogen/library/taste/signals.py +268 -0
  31. mlx_audiogen-0.2.0/mlx_audiogen/lora/__init__.py +28 -0
  32. mlx_audiogen-0.2.0/mlx_audiogen/lora/config.py +139 -0
  33. mlx_audiogen-0.2.0/mlx_audiogen/lora/dataset.py +226 -0
  34. mlx_audiogen-0.2.0/mlx_audiogen/lora/flywheel.py +629 -0
  35. mlx_audiogen-0.2.0/mlx_audiogen/lora/inject.py +117 -0
  36. mlx_audiogen-0.2.0/mlx_audiogen/lora/trainer.py +371 -0
  37. mlx_audiogen-0.2.0/mlx_audiogen/models/__init__.py +5 -0
  38. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/__init__.py +13 -0
  39. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/config.py +60 -0
  40. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/convert.py +334 -0
  41. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/layers.py +385 -0
  42. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/model.py +354 -0
  43. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/pipeline.py +255 -0
  44. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/spec.py +136 -0
  45. mlx_audiogen-0.2.0/mlx_audiogen/models/demucs/transformer.py +313 -0
  46. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/__init__.py +20 -0
  47. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/chroma.py +150 -0
  48. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/config.py +159 -0
  49. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/convert.py +927 -0
  50. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/mert.py +276 -0
  51. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/model.py +302 -0
  52. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/pipeline.py +473 -0
  53. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/style_conditioner.py +276 -0
  54. mlx_audiogen-0.2.0/mlx_audiogen/models/musicgen/transformer.py +267 -0
  55. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/__init__.py +17 -0
  56. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/conditioners.py +178 -0
  57. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/config.py +60 -0
  58. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/convert.py +340 -0
  59. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/dit.py +393 -0
  60. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/pipeline.py +429 -0
  61. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/sampling.py +192 -0
  62. mlx_audiogen-0.2.0/mlx_audiogen/models/stable_audio/vae.py +169 -0
  63. mlx_audiogen-0.2.0/mlx_audiogen/server/__init__.py +21 -0
  64. mlx_audiogen-0.2.0/mlx_audiogen/server/app.py +2462 -0
  65. mlx_audiogen-0.2.0/mlx_audiogen/server/web_dist/assets/index-BrgRrhua.js +188 -0
  66. mlx_audiogen-0.2.0/mlx_audiogen/server/web_dist/assets/index-DHjyV8gX.css +1 -0
  67. mlx_audiogen-0.2.0/mlx_audiogen/server/web_dist/index.html +14 -0
  68. mlx_audiogen-0.2.0/mlx_audiogen/shared/__init__.py +33 -0
  69. mlx_audiogen-0.2.0/mlx_audiogen/shared/audio_io.py +83 -0
  70. mlx_audiogen-0.2.0/mlx_audiogen/shared/audio_to_midi.py +219 -0
  71. mlx_audiogen-0.2.0/mlx_audiogen/shared/encodec.py +776 -0
  72. mlx_audiogen-0.2.0/mlx_audiogen/shared/hub.py +113 -0
  73. mlx_audiogen-0.2.0/mlx_audiogen/shared/midi_to_prompt.py +245 -0
  74. mlx_audiogen-0.2.0/mlx_audiogen/shared/mlx_utils.py +39 -0
  75. mlx_audiogen-0.2.0/mlx_audiogen/shared/model_registry.py +158 -0
  76. mlx_audiogen-0.2.0/mlx_audiogen/shared/prompt_suggestions.py +678 -0
  77. mlx_audiogen-0.2.0/mlx_audiogen/shared/stem_separator.py +234 -0
  78. mlx_audiogen-0.2.0/mlx_audiogen/shared/t5.py +245 -0
  79. mlx_audiogen-0.2.0/mlx_audiogen/version.py +1 -0
  80. mlx_audiogen-0.2.0/pyproject.toml +124 -0
@@ -0,0 +1,61 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ wheels/
8
+ .venv/
9
+
10
+ # MLX / ML
11
+ model/
12
+ mlx_model/
13
+ converted/
14
+ *.npz
15
+ *.safetensors
16
+ !tests/fixtures/*.safetensors
17
+
18
+ # Audio output
19
+ *.wav
20
+ *.mp3
21
+ *.flac
22
+
23
+ # IDE
24
+ .vscode/
25
+ .idea/
26
+ *.swp
27
+
28
+ # OS
29
+ .DS_Store
30
+
31
+ # MCP / tools
32
+ .serena/
33
+ .claude/
34
+
35
+ # uv
36
+ uv.lock
37
+
38
+ # Web UI
39
+ web/node_modules/
40
+ web/dist/
41
+ web/*.tsbuildinfo
42
+
43
+ # JUCE plugin build
44
+ plugin/build/
45
+ plugin/JUCE/
46
+
47
+ # Worktrees
48
+ .worktrees/
49
+
50
+ # Demo/script output
51
+ output/
52
+
53
+ # Superpowers
54
+ .superpowers/
55
+
56
+ # Music library exports (user-specific, used for development/training)
57
+ Library.xml
58
+ rekordbox.xml
59
+
60
+ # Enrichment cache (user-specific)
61
+ enrichment.db
@@ -0,0 +1,190 @@
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 the 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 the 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 any 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
+ Copyright 2024-2026 Jason Vassallo
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,400 @@
1
+ Metadata-Version: 2.4
2
+ Name: mlx-audiogen
3
+ Version: 0.2.0
4
+ Summary: Music and audio generation on Apple Silicon using MLX - MusicGen and Stable Audio Open
5
+ Project-URL: Homepage, https://github.com/jasonvassallo/mlx-audiogen
6
+ Project-URL: Repository, https://github.com/jasonvassallo/mlx-audiogen
7
+ Project-URL: HuggingFace, https://huggingface.co/jasonvassallo
8
+ Author: Jason Vassallo
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: apple-silicon,audio,demucs,mlx,music-generation,musicgen,stable-audio,stem-separation
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: MacOS :: MacOS X
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Multimedia :: Sound/Audio
19
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: defusedxml>=0.7
22
+ Requires-Dist: httpx>=0.27.0
23
+ Requires-Dist: huggingface-hub>=0.27.0
24
+ Requires-Dist: keyring>=25.0.0
25
+ Requires-Dist: mlx>=0.25.2
26
+ Requires-Dist: numpy>=1.26.4
27
+ Requires-Dist: safetensors>=0.4.0
28
+ Requires-Dist: sentencepiece>=0.2.0
29
+ Requires-Dist: sounddevice>=0.5.0
30
+ Requires-Dist: soundfile>=0.12.0
31
+ Requires-Dist: tokenizers>=0.19.0
32
+ Requires-Dist: tqdm>=4.66.0
33
+ Requires-Dist: transformers>=4.40.0
34
+ Provides-Extra: convert
35
+ Requires-Dist: torch>=2.0.0; extra == 'convert'
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
38
+ Requires-Dist: ruff>=0.4.0; extra == 'dev'
39
+ Provides-Extra: llm
40
+ Requires-Dist: mlx-lm>=0.22.0; extra == 'llm'
41
+ Provides-Extra: server
42
+ Requires-Dist: fastapi>=0.110.0; extra == 'server'
43
+ Requires-Dist: python-multipart>=0.0.18; extra == 'server'
44
+ Requires-Dist: uvicorn[standard]>=0.27.0; extra == 'server'
45
+ Description-Content-Type: text/markdown
46
+
47
+ # mlx-audiogen
48
+
49
+ ![CI](https://github.com/jasonvassallo/mlx-audiogen/actions/workflows/ci.yml/badge.svg)
50
+ ![Integration](https://github.com/jasonvassallo/mlx-audiogen/actions/workflows/integration.yml/badge.svg)
51
+
52
+ Text-to-audio generation and stem separation on Apple Silicon using [MLX](https://github.com/ml-explore/mlx). Supports **MusicGen**, **Stable Audio Open**, and **Demucs v4** stem separation.
53
+
54
+ Runs entirely on-device via Metal GPU — no cloud API needed.
55
+
56
+ **Full stack:** CLI, HTTP server, React web UI, VST3/AU plugin, Max for Live device, cloud deployment.
57
+
58
+ ## Installation
59
+
60
+ ### pip (recommended)
61
+
62
+ ```bash
63
+ pip install mlx-audiogen # CLI + audio generation
64
+ pip install mlx-audiogen[server] # + HTTP server & web UI
65
+ pip install mlx-audiogen[llm] # + LLM prompt enhancement
66
+ pip install mlx-audiogen[server,llm] # Everything
67
+ ```
68
+
69
+ ### Homebrew
70
+
71
+ ```bash
72
+ brew tap jasonvassallo/tap
73
+ brew install mlx-audiogen # CLI + server
74
+ brew install mlx-audiogen --with-llm # + LLM prompt enhancement
75
+ ```
76
+
77
+ ### uv
78
+
79
+ ```bash
80
+ uv pip install mlx-audiogen[server]
81
+ ```
82
+
83
+ > **Requires macOS with Apple Silicon** (M1 or later). MLX does not support other platforms.
84
+
85
+ ### Extras
86
+
87
+ | Extra | What it adds | Key dependency |
88
+ |-------|-------------|----------------|
89
+ | (base) | CLI, audio generation, model auto-download | mlx, numpy, transformers |
90
+ | `[server]` | HTTP server, web UI, async jobs | FastAPI, uvicorn |
91
+ | `[llm]` | AI prompt enhancement, suggestions | mlx-lm (model downloads on first use) |
92
+ | `[convert]` | Convert PyTorch weights to MLX | torch |
93
+
94
+ ## Supported Models
95
+
96
+ | Model | Variants | Output | Sample Rate | Architecture |
97
+ |-------|----------|--------|-------------|--------------|
98
+ | MusicGen | small, medium, large | Mono | 32 kHz | Autoregressive (T5 + Transformer + EnCodec) |
99
+ | MusicGen Stereo | small, medium, large | Stereo | 32 kHz | Autoregressive (8 codebooks) |
100
+ | MusicGen Melody | base, large | Mono | 32 kHz | Autoregressive + Chroma conditioning |
101
+ | MusicGen Stereo Melody | base, large | Stereo | 32 kHz | Autoregressive (8 codebooks + Chroma) |
102
+ | MusicGen Style | base | Mono | 32 kHz | Autoregressive + MERT style conditioning |
103
+ | Stable Audio Open | small | Stereo | 44.1 kHz | Diffusion (T5 + DiT + Oobleck VAE) |
104
+ | Stable Audio Open | 1.0 | Stereo | 44.1 kHz | Diffusion (larger DiT, dual time conditioning) |
105
+ | HTDemucs (Demucs v4) | htdemucs, htdemucs_6s | 4 or 6 stems | 44.1 kHz | Hybrid U-Net + Cross-Transformer |
106
+
107
+ Pre-converted MLX weights for all variants are available on [HuggingFace](https://huggingface.co/jasonvassallo).
108
+
109
+ ## Quick Start
110
+
111
+ ```bash
112
+ # Install with server + web UI
113
+ pip install mlx-audiogen[server]
114
+
115
+ # Generate audio (model auto-downloads on first use)
116
+ mlx-audiogen --model musicgen --prompt "happy upbeat rock song" --seconds 10
117
+
118
+ # Launch web UI
119
+ mlx-audiogen-app
120
+
121
+ # See all options
122
+ mlx-audiogen --help
123
+ ```
124
+
125
+ ### Melody Conditioning Example
126
+
127
+ MusicGen melody variants can condition generation on an existing audio file, extracting its pitch contour (chromagram) to guide the output:
128
+
129
+ ```bash
130
+ # Convert a melody variant
131
+ mlx-audiogen-convert --model facebook/musicgen-melody --output ./converted/musicgen-melody
132
+
133
+ # Generate with melody conditioning
134
+ mlx-audiogen \
135
+ --model musicgen \
136
+ --prompt "orchestral arrangement with strings" \
137
+ --melody my_humming.wav \
138
+ --seconds 10 \
139
+ --output orchestral.wav
140
+ ```
141
+
142
+ The `--melody` flag accepts any WAV file. The pipeline extracts a 12-bin chromagram (one-hot pitch class per frame) and uses it as additional cross-attention conditioning alongside the text prompt. Melody variants also work without `--melody` for text-only generation.
143
+
144
+ ### Style Conditioning Example
145
+
146
+ MusicGen style variants use a frozen MERT audio feature extractor to capture the timbre and texture of a reference audio clip, then guide generation via dual classifier-free guidance:
147
+
148
+ ```bash
149
+ # Convert the style variant (uses audiocraft format, downloads MERT weights)
150
+ mlx-audiogen-convert --model facebook/musicgen-style --output ./converted/musicgen-style
151
+
152
+ # Generate with style conditioning
153
+ mlx-audiogen \
154
+ --model musicgen \
155
+ --prompt "upbeat electronic dance music" \
156
+ --style-audio reference_track.wav \
157
+ --style-coef 5.0 \
158
+ --seconds 10 \
159
+ --output styled.wav
160
+ ```
161
+
162
+ The `--style-audio` flag accepts any WAV file as a timbre reference. The pipeline uses dual-CFG with three forward passes per step to blend text semantics with audio style. `--style-coef` controls how strongly the text prompt influences the output relative to the style (default: 5.0). Style variants also work without `--style-audio` for text-only generation.
163
+
164
+ ### Stem Separation (Demucs v4)
165
+
166
+ Separate any audio into drums, bass, vocals, and other stems using the native MLX port of Meta's HTDemucs:
167
+
168
+ ```bash
169
+ # Convert Demucs weights (one-time, requires torch)
170
+ pip install mlx-audiogen[convert]
171
+ mlx-audiogen-convert --model htdemucs --output ./converted/demucs-htdemucs
172
+ ```
173
+
174
+ The pipeline auto-downloads pre-converted weights from [HuggingFace](https://huggingface.co/jasonvassallo/demucs-htdemucs-mlx) if no local weights are found. Inference runs 100% on MLX — PyTorch is only needed for one-time weight conversion.
175
+
176
+ ## HTTP Server
177
+
178
+ An optional FastAPI server enables integration with the web UI, DAW plugins, Max for Live, or any HTTP client:
179
+
180
+ ```bash
181
+ # Install server dependencies (if not already)
182
+ pip install mlx-audiogen[server]
183
+
184
+ # Launch app with web UI and auto-discover all converted models
185
+ mlx-audiogen-app
186
+
187
+ # Or start server with specific models
188
+ mlx-audiogen-server --weights-dir ./converted/musicgen-small --port 8420
189
+
190
+ # Multiple models (LRU cache keeps the 2 most recently used loaded)
191
+ mlx-audiogen-server \
192
+ --weights-dir ./converted/musicgen-small \
193
+ --weights-dir ./converted/stable-audio \
194
+ --port 8420
195
+
196
+ # Open browser on launch
197
+ mlx-audiogen-server --weights-dir ./converted/musicgen-small --open
198
+
199
+ # Remote access (for web UI on other devices or cloud deployment)
200
+ mlx-audiogen-server --weights-dir ./converted/musicgen-small --host 0.0.0.0
201
+ ```
202
+
203
+ ### API Endpoints
204
+
205
+ | Method | Path | Description |
206
+ |--------|------|-------------|
207
+ | `POST` | `/api/generate` | Submit generation request (returns job ID). Supports `output_mode`: `audio`, `midi`, or `both` |
208
+ | `GET` | `/api/status/{id}` | Poll job status (`queued`/`running`/`done`/`error`) with real-time `progress` (0.0-1.0) |
209
+ | `GET` | `/api/audio/{id}` | Download generated WAV |
210
+ | `GET` | `/api/midi/{id}` | Download generated MIDI (when `output_mode` is `midi` or `both`) |
211
+ | `GET` | `/api/models` | List available models and loading status |
212
+ | `GET` | `/api/jobs` | List all active/recent jobs |
213
+ | `GET` | `/api/health` | Health check for browser heartbeat |
214
+ | `POST` | `/api/suggest` | AI prompt suggestions (analyze prompt + return refined versions) |
215
+ | `POST` | `/api/enhance` | Enhance prompt via local LLM or template fallback |
216
+ | `POST` | `/api/midi-to-prompt` | Convert MIDI file to descriptive text prompt |
217
+ | `POST` | `/api/separate/{id}` | Separate audio into stems (drums/bass/vocals/other) |
218
+ | `GET` | `/api/presets` | List shared presets |
219
+ | `POST` | `/api/presets/{name}` | Save a preset |
220
+ | `GET` | `/api/presets/{name}` | Load a preset |
221
+ | `GET` | `/api/tags` | Tag database for prompt autocomplete |
222
+ | `GET` | `/api/llm/models` | List discovered local LLM models |
223
+ | `POST` | `/api/llm/select` | Select and load an LLM model |
224
+ | `GET` | `/api/memory` | Get prompt memory (history + style profile) |
225
+ | `GET` | `/api/settings` | Get server settings |
226
+ | `POST` | `/api/settings` | Update server settings |
227
+
228
+ Interactive API docs at `http://localhost:8420/docs` when running.
229
+
230
+ ## Web UI
231
+
232
+ A React + TypeScript SPA with a dark, DAW-inspired interface:
233
+
234
+ ```bash
235
+ # Development (hot reload, proxies API to :8420)
236
+ cd web && npm install && npm run dev # http://localhost:3000
237
+
238
+ # Production (built and served by FastAPI)
239
+ cd web && npm run build
240
+ ```
241
+
242
+ Features:
243
+ - **Generation**: Model selector, prompt textarea with tag autocomplete, model-aware parameter sliders, BPM-based duration mode
244
+ - **AI Enhancement**: Local LLM prompt enhancement with preview (accept/edit/use original)
245
+ - **Suggestions**: Prompt analysis tags (genre, mood, instruments) + refined suggestion cards
246
+ - **Playback**: Web Audio API waveform visualization, BPM-synced looping, time-stretch or vinyl pitch modes
247
+ - **Transport Bar**: DAW-style bottom bar with master BPM, pitch mode, audio device selector, connection status
248
+ - **History**: IndexedDB-persisted generation history with favorites, auto-delete retention, MIDI download
249
+ - **Stem Separation**: Color-coded inline audio players for drums/bass/vocals/other
250
+ - **Presets**: Save/load generation parameter presets
251
+ - **Remote Server**: Connect to a remote mlx-audiogen server (e.g., cloud Mac Mini)
252
+
253
+ ## Native Plugin (VST3 / AU)
254
+
255
+ A JUCE-based plugin for Ableton Live, Logic Pro, and other DAWs:
256
+
257
+ ```bash
258
+ cd plugin && git submodule update --init # first time: clone JUCE
259
+ cmake -B build -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release
260
+ # Installs to ~/Library/Audio/Plug-Ins/{VST3,Components}/
261
+ ```
262
+
263
+ Features: auto-server-launch, local/remote server fallback (with Cloudflare Access auth), model auto-discovery, BPM sync, MIDI trigger, A/B/C/D variations, keep/discard workflow, beat-grid trimming, effects chain, Push 2 APVTS compatibility.
264
+
265
+ ## Max for Live Integration
266
+
267
+ A Node for Max client (`m4l/mlx-audiogen.js`) connects Ableton Live directly to the HTTP server for generating audio from within your session:
268
+
269
+ 1. Start the server (see above)
270
+ 2. Load the Max for Live device onto a MIDI track
271
+ 3. Type a prompt and click Generate — the WAV is auto-saved and the path is output for drag-to-track
272
+
273
+ See [`m4l/README.md`](m4l/README.md) for message reference and outlet documentation.
274
+
275
+ ## Requirements
276
+
277
+ - **macOS with Apple Silicon** (M1 or later) — MLX requires Metal GPU
278
+ - Python 3.11+ (automatically satisfied by pip/brew install)
279
+
280
+ ## CLI Parameters
281
+
282
+ ### Generation (`mlx-audiogen`)
283
+
284
+ | Parameter | MusicGen | Stable Audio | Default | Description |
285
+ |-----------|:--------:|:------------:|---------|-------------|
286
+ | `--model` | required | required | — | `musicgen` or `stable_audio` |
287
+ | `--prompt` | required | required | — | Text description of desired audio |
288
+ | `--seconds` | yes | yes | 5.0 | Duration (max ~30s for MusicGen, ~47s for Stable Audio) |
289
+ | `--output` | yes | yes | auto | Output WAV file path |
290
+ | `--seed` | yes | yes | random | Random seed for reproducibility |
291
+ | `--weights-dir` | yes | yes | — | Path to converted weights directory |
292
+ | `--temperature` | yes | — | 1.0 | Sampling temperature (higher = more creative) |
293
+ | `--top-k` | yes | — | 250 | Top-k sampling candidates |
294
+ | `--guidance-coef` | yes | — | 3.0 | Classifier-free guidance scale |
295
+ | `--melody` | yes | — | — | Audio file for melody conditioning (melody variants only) |
296
+ | `--style-audio` | yes | — | — | Audio file for style conditioning (style variants only) |
297
+ | `--style-coef` | yes | — | 5.0 | Dual-CFG text influence coefficient (style variants only) |
298
+ | `--steps` | — | yes | 8 | Number of diffusion steps |
299
+ | `--cfg-scale` | — | yes | 6.0 | CFG guidance scale |
300
+ | `--sampler` | — | yes | euler | ODE sampler (`euler` or `rk4`) |
301
+ | `--negative-prompt` | — | yes | "" | Negative prompt for CFG |
302
+
303
+ ### Conversion (`mlx-audiogen-convert`)
304
+
305
+ | Parameter | Description |
306
+ |-----------|-------------|
307
+ | `--model` | HuggingFace repo ID (e.g., `facebook/musicgen-small`) or Demucs variant (`htdemucs`) |
308
+ | `--output` | Output directory for converted weights |
309
+ | `--dtype` | Optional: `float16`, `bfloat16`, or `float32` |
310
+ | `--trust-remote-code` | Allow non-whitelisted repo IDs |
311
+
312
+ #### Supported Repos
313
+
314
+ **MusicGen (mono):** `facebook/musicgen-small`, `facebook/musicgen-medium`, `facebook/musicgen-large`
315
+
316
+ **MusicGen Stereo:** `facebook/musicgen-stereo-small`, `facebook/musicgen-stereo-medium`, `facebook/musicgen-stereo-large`
317
+
318
+ **MusicGen Melody:** `facebook/musicgen-melody`, `facebook/musicgen-melody-large`
319
+
320
+ **MusicGen Stereo Melody:** `facebook/musicgen-stereo-melody`, `facebook/musicgen-stereo-melody-large`
321
+
322
+ **MusicGen Style:** `facebook/musicgen-style`
323
+
324
+ **Stable Audio:** `stabilityai/stable-audio-open-small`, `stabilityai/stable-audio-open-1.0`
325
+
326
+ **Demucs:** `htdemucs`, `htdemucs_6s`
327
+
328
+ > **Note:** Some HF repos (musicgen-medium, musicgen-large) only provide `pytorch_model.bin` files instead of safetensors. The converter handles both formats automatically, but PyTorch must be installed (`pip install mlx-audiogen[convert]`).
329
+
330
+ > **Note:** `stabilityai/stable-audio-open-1.0` is a gated model. You must accept the license agreement on the [HuggingFace model page](https://huggingface.co/stabilityai/stable-audio-open-1.0) before converting.
331
+
332
+ ## Architecture
333
+
334
+ ```
335
+ mlx_audiogen/
336
+ ├── shared/ # T5 encoder, EnCodec, hub utils, audio I/O, MIDI, stem separation
337
+ ├── models/
338
+ │ ├── musicgen/ # Autoregressive: T5 -> transformer -> EnCodec decode
339
+ │ │ ├── chroma.py # Chromagram extraction for melody conditioning
340
+ │ │ ├── mert.py # MERT feature extractor for style conditioning
341
+ │ │ └── style_conditioner.py # Style transformer + RVQ + BatchNorm
342
+ │ ├── stable_audio/ # Diffusion: T5 -> DiT (rectified flow) -> VAE decode
343
+ │ └── demucs/ # Source separation: HTDemucs v4 (hybrid U-Net + cross-transformer)
344
+ ├── server/ # FastAPI HTTP server with LRU pipeline cache
345
+ ├── cli/ # Unified CLI for generation and conversion
346
+ web/ # React + Vite + TypeScript SPA (dark/pro audio UI)
347
+ plugin/ # JUCE native VST3/AU plugin
348
+ m4l/ # Max for Live Node.js HTTP client for Ableton
349
+ ```
350
+
351
+ **MusicGen**: Text -> T5 encode -> autoregressive transformer with KV cache + classifier-free guidance + codebook delay pattern -> top-k sampling -> EnCodec decode -> 32kHz WAV
352
+
353
+ **MusicGen Melody**: Text -> T5 encode + chromagram from audio -> cross-attention conditioning -> same pipeline as above
354
+
355
+ **MusicGen Style**: MERT extracts features from reference audio -> style transformer + RVQ -> dual-CFG with 3 forward passes per step (full, style-only, unconditional) -> same decode pipeline
356
+
357
+ **Stable Audio**: Text -> T5 encode + time conditioning -> rectified flow ODE sampling through DiT -> Oobleck VAE decode -> 44.1kHz stereo WAV
358
+
359
+ **HTDemucs (Demucs v4)**: Stereo 44.1kHz audio -> STFT -> complex-as-channels -> instance normalize -> parallel spectral U-Net + temporal U-Net with DConv residual branches -> CrossTransformerEncoder (5 layers, alternating self-attention and cross-attention) -> parallel decoder U-Nets with skip connections -> CaC mask + iSTFT + temporal denormalize -> 4 stems (drums, bass, other, vocals)
360
+
361
+ ## Development
362
+
363
+ ```bash
364
+ # Clone and install in development mode
365
+ git clone https://github.com/jasonvassallo/mlx-audiogen
366
+ cd mlx-audiogen
367
+ uv sync
368
+
369
+ # Run from source
370
+ uv run mlx-audiogen --model musicgen --prompt "test" --seconds 5
371
+
372
+ # Run tests
373
+ uv run pytest # all tests (512 tests, ~14s)
374
+ uv run pytest -m integration -v # integration tests (real weights + GPU)
375
+ uv run pytest tests/test_specific.py::test_name # single test
376
+
377
+ # Lint
378
+ uv run ruff check .
379
+ uv run ruff format .
380
+
381
+ # Type checking
382
+ uv run mypy mlx_audiogen/
383
+
384
+ # Security audit
385
+ uv run bandit -r mlx_audiogen/ -c pyproject.toml
386
+ uv run pip-audit
387
+ ```
388
+
389
+ ## License
390
+
391
+ Apache 2.0 — see [LICENSE](LICENSE).
392
+
393
+ ## Links
394
+
395
+ - [GitHub](https://github.com/jasonvassallo/mlx-audiogen)
396
+ - [HuggingFace](https://huggingface.co/jasonvassallo)
397
+ - [Demucs MLX Weights](https://huggingface.co/jasonvassallo/demucs-htdemucs-mlx)
398
+ - [MusicGen paper](https://arxiv.org/abs/2306.05284)
399
+ - [Stable Audio Open paper](https://arxiv.org/abs/2407.14358)
400
+ - [Demucs v4 paper](https://arxiv.org/abs/2211.08553)