tuneframes 0.1.0 → 0.1.1

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.
package/LICENSE CHANGED
@@ -1,199 +1,167 @@
1
- http://www.apache.org/licenses/
2
-
3
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
-
5
- 1. Definitions.
6
-
7
- "License" shall mean the terms and conditions for use, reproduction,
8
- and distribution as defined by Sections 1 through 9 of this document.
9
-
10
- "Licensor" shall mean the copyright owner or entity authorized by
11
- the copyright owner that is granting the License.
12
-
13
- "Legal Entity" shall mean the union of the acting entity and all
14
- other entities that control, are controlled by, or are under common
15
- control with that entity. For the purposes of this definition,
16
- "control" means (i) the power, direct or indirect, to cause the
17
- direction or management of such entity, whether by contract or
18
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
19
- outstanding shares, or (iii) beneficial ownership of such entity.
20
-
21
- "You" (or "Your") shall mean an individual or Legal Entity
22
- exercising permissions granted by this License.
23
-
24
- "Source" form shall mean the preferred form for making modifications,
25
- including but not limited to software source code, documentation
26
- source, and configuration files.
27
-
28
- "Object" form shall mean any form resulting from mechanical
29
- transformation or translation of a Source form, including but
30
- not limited to compiled object code, generated documentation,
31
- and conversions to other media types.
32
-
33
- "Work" shall mean the work of authorship, whether in Source or
34
- Object form, made available under the License, as indicated by a
35
- copyright notice that is included in or attached to the work
36
- (an example is provided in the Appendix below).
37
-
38
- "Derivative Works" shall mean any work, whether in Source or Object
39
- form, that is based on (or derived from) the Work and for which the
40
- editorial revisions, annotations, elaborations, or other modifications
41
- represent, as a whole, an original work of authorship. For the purposes
42
- of this License, Derivative Works shall not include works that remain
43
- separable from, or merely link (or bind by name) to the interfaces of,
44
- the Work and Derivative Works thereof.
45
-
46
- "Contribution" shall mean any work of authorship, including
47
- the original version of the Work and any modifications or additions
48
- to that Work or Derivative Works thereof, that is intentionally
49
- submitted to Licensor for inclusion in the Work by the copyright owner
50
- or by an individual or Legal Entity authorized to submit on behalf of
51
- the copyright owner. For the purposes of this definition, "submitted"
52
- means any form of electronic, verbal, or written communication sent
53
- to the Licensor or its representatives, including but not limited to
54
- communication on electronic mailing lists, source code control systems,
55
- and issue tracking systems that are managed by, or on behalf of, the
56
- Licensor for the purpose of discussing and improving the Work, but
57
- excluding communication that is conspicuously marked or otherwise
58
- designated in writing by the copyright owner as "Not a Contribution."
59
-
60
- "Contributor" shall mean Licensor and any individual or Legal Entity
61
- on behalf of whom a Contribution has been received by Licensor and
62
- subsequently incorporated within the Work.
63
-
64
- 2. Grant of Copyright License. Subject to the terms and conditions of
65
- this License, each Contributor hereby grants to You a perpetual,
66
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
67
- copyright license to reproduce, prepare Derivative Works of,
68
- publicly display, publicly perform, sublicense, and distribute the
69
- Work and such Derivative Works in Source or Object form.
70
-
71
- 3. Grant of Patent License. Subject to the terms and conditions of
72
- this License, each Contributor hereby grants to You a perpetual,
73
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
74
- (except as stated in this section) patent license to make, have made,
75
- use, offer to sell, sell, import, and otherwise transfer the Work,
76
- where such license applies only to those patent claims licensable
77
- by such Contributor that are necessarily infringed by their
78
- Contribution(s) alone or by combination of their Contribution(s)
79
- with the Work to which such Contribution(s) was submitted. If You
80
- institute patent litigation against any entity (including a
81
- cross-claim or counterclaim in a lawsuit) alleging that the Work
82
- or a Contribution incorporated within the Work constitutes direct
83
- or contributory patent infringement, then any patent licenses
84
- granted to You under this License for that Work shall terminate
85
- as of the date such litigation is filed.
86
-
87
- 4. Redistribution. You may reproduce and distribute copies of the
88
- Work or Derivative Works thereof in any medium, with or without
89
- modifications, and in Source or Object form, provided that You
90
- meet the following conditions:
91
-
92
- (a) You must give any other recipients of the Work or
93
- Derivative Works a copy of this License; and
94
-
95
- (b) You must cause any modified files to carry prominent notices
96
- stating that You changed the files; and
97
-
98
- (c) You must retain, in the Source form of any Derivative Works
99
- that You distribute, all copyright, patent, trademark, and
100
- attribution notices from the Source form of the Work,
101
- excluding those notices that do not pertain to any part of
102
- the Derivative Works; and
103
-
104
- (d) If the Work includes a "NOTICE" text file as part of its
105
- distribution, then any Derivative Works that You distribute must
106
- include a readable copy of the attribution notices contained
107
- within such NOTICE file, excluding those notices that do not
108
- pertain to any part of the Derivative Works, in at least one
109
- of the following places: within a NOTICE text file distributed
110
- as part of the Derivative Works; within the Source form or
111
- documentation, if provided along with the Derivative Works; or,
112
- within a display generated by the Derivative Works, if and
113
- wherever such third-party notices normally appear. The contents
114
- of the NOTICE file are for informational purposes only and
115
- do not modify the License. You may add Your own attribution
116
- notices within Derivative Works that You distribute, alongside
117
- or as an addendum to the NOTICE text from the Work, provided
118
- that such additional attribution notices cannot be construed
119
- as modifying the License.
120
-
121
- You may add Your own copyright statement to Your modifications and
122
- may provide additional or different license terms and conditions
123
- for use, reproduction, or distribution of Your modifications, or
124
- for any such Derivative Works as a whole, provided Your use,
125
- reproduction, and distribution of the Work otherwise complies with
126
- the conditions stated in this License.
127
-
128
- 5. Submission of Contributions. Unless You explicitly state otherwise,
129
- any Contribution intentionally submitted for inclusion in the Work
130
- by You to the Licensor shall be under the terms and conditions of
131
- this License, without any additional terms or conditions.
132
- Notwithstanding the above, nothing herein shall supersede or modify
133
- the terms of any separate license agreement you may have executed
134
- with Licensor regarding such Contributions.
135
-
136
- 6. Trademarks. This License does not grant permission to use the trade
137
- names, trademarks, service marks, or product names of the Licensor,
138
- except as required for reasonable and customary use in describing the
139
- origin of the Work and reproducing the content of the NOTICE file.
140
-
141
- 7. Disclaimer of Warranty. Unless required by applicable law or
142
- agreed to in writing, Licensor provides the Work (and each
143
- Contributor provides its Contributions) on an "AS IS" BASIS,
144
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
145
- implied, including, without limitation, any warranties or conditions
146
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
147
- PARTICULAR PURPOSE. You are solely responsible for determining the
148
- appropriateness of using or redistributing the Work and assume any
149
- risks associated with Your exercise of permissions under this License.
150
-
151
- 8. Limitation of Liability. In no event and under no legal theory,
152
- whether in tort (including negligence), contract, or otherwise,
153
- unless required by applicable law (such as deliberate and grossly
154
- negligent acts) or agreed to in writing, shall any Contributor be
155
- liable to You for damages, including any direct, indirect, special,
156
- incidental, or consequential damages of any character arising as a
157
- result of this License or out of the use or inability to use the
158
- Work (including but not limited to damages for loss of goodwill,
159
- work stoppage, computer failure or malfunction, or any and all
160
- other commercial damages or losses), even if such Contributor
161
- has been advised of the possibility of such damages.
162
-
163
- 9. Accepting Warranty or Additional Liability. While redistributing
164
- the Work or Derivative Works thereof, You may choose to offer,
165
- and charge a fee for, acceptance of support, warranty, indemnity,
166
- or other liability obligations and/or rights consistent with this
167
- License. However, in accepting such obligations, You may act only
168
- on Your own behalf and on Your sole responsibility, not on behalf
169
- of any other Contributor, and only if You agree to indemnify,
170
- defend, and hold each Contributor harmless for any liability
171
- incurred by, or claims asserted against, such Contributor by reason
172
- of your accepting any such warranty or additional liability.
173
-
174
- END OF TERMS AND CONDITIONS
175
-
176
- APPENDIX: How to apply the Apache License to your work.
177
-
178
- To apply the Apache License to your work, attach the following
179
- boilerplate notice, with the fields enclosed by brackets "[]"
180
- replaced with your own identifying information. (Don't include
181
- the brackets!) The text should be enclosed in the appropriate
182
- comment syntax for the file format. We also recommend that a
183
- file or class name and description of purpose be included on the
184
- same "printed page" as the copyright notice for easier
185
- identification within third-party archives.
186
-
187
- Copyright [yyyy] [name of copyright owner]
188
-
189
- Licensed under the Apache License, Version 2.0 (the "License");
190
- you may not use this file except in compliance with the License.
191
- You may obtain a copy of the License at
192
-
193
- http://www.apache.org/licenses/LICENSE-2.0
194
-
195
- Unless required by applicable law or agreed to in writing, software
196
- distributed under the License is distributed on an "AS IS" BASIS,
197
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198
- See the License for the specific language governing permissions and
199
- limitations under the License.
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
+
39
+ "Contribution" shall mean any work of authorship, including
40
+ the original version of the Work and any modifications or additions
41
+ to that Work or Derivative Works thereof, that is intentionally
42
+ submitted to the Licensor for inclusion in the Work by the copyright owner
43
+ or by an individual or Legal Entity authorized to submit on behalf of
44
+ the copyright owner. For the purposes of this definition, "submitted"
45
+ means any form of electronic, verbal, or written communication sent
46
+ to the Licensor or its representatives, including but not limited to
47
+ communication on electronic mailing lists, source code control systems,
48
+ and issue tracking systems that are managed by, or on behalf of, the
49
+ Licensor for the purpose of discussing and improving the Work, but
50
+ excluding communication that is conspicuously marked or otherwise
51
+ designated in writing by the copyright owner as "Not a Contribution."
52
+
53
+ "Contributor" shall mean Licensor and any individual or Legal Entity
54
+ on behalf of whom a Contribution has been received by Licensor and
55
+ subsequently incorporated within the Work.
56
+
57
+ 2. Grant of Copyright License. Subject to the terms and conditions of
58
+ this License, each Contributor hereby grants to You a perpetual,
59
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
60
+ copyright license to reproduce, prepare Derivative Works of,
61
+ publicly display, publicly perform, sublicense, and distribute the
62
+ Work and such Derivative Works in Source or Object form.
63
+
64
+ 3. Grant of Patent License. Subject to the terms and conditions of
65
+ this License, each Contributor hereby grants to You a perpetual,
66
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
67
+ (except as stated in this section) patent license to make, have made,
68
+ use, offer to sell, sell, import, and otherwise transfer the Work,
69
+ where such license applies only to those patent claims licensable
70
+ by such Contributor that are necessarily infringed by their
71
+ Contribution(s) alone or by combination of their Contribution(s)
72
+ with the Work to which such Contribution(s) was submitted. If You
73
+ institute patent litigation against any entity (including a
74
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
75
+ or a Contribution incorporated within the Work constitutes direct
76
+ or contributory patent infringement, then any patent licenses
77
+ granted to You under this License for that Work shall terminate
78
+ as of the date such litigation is filed.
79
+
80
+ 4. Redistribution. You may reproduce and distribute copies of the
81
+ Work or Derivative Works thereof in any medium, with or without
82
+ modifications, and in Source or Object form, provided that You
83
+ meet the following conditions:
84
+
85
+ (a) You must give any other recipients of the Work or
86
+ Derivative Works a copy of this License; and
87
+
88
+ (b) You must cause any modified files to carry prominent notices
89
+ stating that You changed the files; and
90
+
91
+ (c) You must retain, in the Source form of any Derivative Works
92
+ that You distribute, all copyright, patent, trademark, and
93
+ attribution notices from the Source form of the Work,
94
+ excluding those notices that do not pertain to any part of
95
+ the Derivative Works; and
96
+
97
+ (d) If the Work includes a "NOTICE" text file as part of its
98
+ distribution, then any Derivative Works that You distribute must
99
+ include a readable copy of the attribution notices contained
100
+ within such NOTICE file, excluding those notices that do not
101
+ pertain to any part of the Derivative Works, in at least one
102
+ of the following places: within a NOTICE text file distributed
103
+ as part of the Derivative Works; within the Source form or
104
+ documentation, if provided along with the Derivative Works; or,
105
+ within a display generated by the Derivative Works, if and
106
+ wherever such third-party notices normally appear. The contents
107
+ of the NOTICE file are for informational purposes only and
108
+ do not modify the License. You may add Your own attribution
109
+ notices within Derivative Works that You distribute, alongside
110
+ or as an addendum to the NOTICE text from the Work, provided
111
+ that such additional attribution notices cannot be construed
112
+ as modifying the License.
113
+
114
+ You may add Your own copyright statement to Your modifications and
115
+ may provide additional or different license terms and conditions
116
+ for use, reproduction, or distribution of Your modifications, or
117
+ for any such Derivative Works as a whole, provided Your use,
118
+ reproduction, and distribution of the Work otherwise complies with
119
+ the conditions stated in this License.
120
+
121
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
122
+ any Contribution intentionally submitted for inclusion in the Work
123
+ by You to the Licensor shall be under the terms and conditions of
124
+ this License, without any additional terms or conditions.
125
+ Notwithstanding the above, nothing herein shall supersede or modify
126
+ the terms of any separate license agreement you may have executed
127
+ with Licensor regarding such Contributions.
128
+
129
+ 6. Trademarks. This License does not grant permission to use the trade
130
+ names, trademarks, service marks, or product names of the Licensor,
131
+ except as required for reasonable and customary use in describing the
132
+ origin of the Work and reproducing the content of the NOTICE file.
133
+
134
+ 7. Disclaimer of Warranty. Unless required by applicable law or
135
+ agreed to in writing, Licensor provides the Work (and each
136
+ Contributor provides its Contributions) on an "AS IS" BASIS,
137
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
138
+ implied, including, without limitation, any warranties or conditions
139
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
140
+ PARTICULAR PURPOSE. You are solely responsible for determining the
141
+ appropriateness of using or redistributing the Work and assume any
142
+ risks associated with Your exercise of permissions under this License.
143
+
144
+ 8. Limitation of Liability. In no event and under no legal theory,
145
+ whether in tort (including negligence), contract, or otherwise,
146
+ unless required by applicable law (such as deliberate and grossly
147
+ negligent acts) or agreed to in writing, shall any Contributor be
148
+ liable to You for damages, including any direct, indirect, special,
149
+ incidental, or consequential damages of any character arising as a
150
+ result of this License or out of the use or inability to use the
151
+ Work (including but not limited to damages for loss of goodwill,
152
+ work stoppage, computer failure or malfunction, or any and all
153
+ other commercial damages or losses), even if such Contributor
154
+ has been advised of the possibility of such damages.
155
+
156
+ 9. Accepting Warranty or Additional Liability. While redistributing
157
+ the Work or Derivative Works thereof, You may choose to offer,
158
+ and charge a fee for, acceptance of support, warranty, indemnity,
159
+ or other liability obligations and/or rights consistent with this
160
+ License. However, in accepting such obligations, You may act only
161
+ on Your own behalf and on Your sole responsibility, not on behalf
162
+ of any other Contributor, and only if You agree to indemnify,
163
+ defend, and hold each Contributor harmless for any liability
164
+ incurred by, or claims asserted against, such Contributor by reason
165
+ of your accepting any such warranty or additional liability.
166
+
167
+ END OF TERMS AND CONDITIONS
package/README.md CHANGED
@@ -1,160 +1,110 @@
1
- # TuneFrames — Agent-Native Music Generation
1
+ # TuneFrames
2
2
 
3
- **Write music compositions in HTML. Render them to MP3 with one CLI command.**
3
+ **Agent-native music generation.**
4
4
 
5
- TuneFrames brings the same portability model that Hyperframes (97K npm downloads/month) proved for video to audio. Every AI agent, Claude Code session, and workflow tool can now compose music without a single line of native audio code.
5
+ Write a single HTML file with Tone.js. Render it to MP3 or WAV with one command. No per-render fees. No Suno wrapper. Your agent, your audio.
6
6
 
7
- ```bash
8
- npx tuneframes init my-track
9
- cd my-track && npx tuneframes render composition.html
10
- # Done. my-track/output.mp3 is ready.
11
- ```
12
-
13
- ---
14
-
15
- ## How It Works
16
-
17
- 1. **Write HTML** with Tone.js — same API every web developer already knows
18
- 2. **Add a metadata block** so TuneFrames knows the tempo and duration
19
- 3. **Run `tuneframes render`** — Chromium headless renders the composition offline, FFmpeg encodes to MP3/WAV
20
-
21
- ```html
22
- <!DOCTYPE html>
23
- <html>
24
- <head>
25
- <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
26
- </head>
27
- <body>
28
- <div id="tuneframes" style="display:none">{"bpm":120,"duration":"4n"}</div>
29
- <script>
30
- async function main() {
31
- await Tone.start();
32
- const synth = new Tone.Synth().toDestination();
33
- synth.triggerAttackRelease('C4', '4n', 0);
34
- synth.triggerAttackRelease('E4', '4n', Tone.Time('4n').toSeconds());
35
- synth.triggerAttackRelease('G4', '4n', Tone.Time('4n').toSeconds() * 2);
36
- }
37
- </script>
38
- </body>
39
- </html>
40
7
  ```
41
-
42
- ---
43
-
44
- ## Examples
45
-
46
- | Example | Description | BPM | Duration |
47
- |---------|-------------|-----|----------|
48
- | `minimal` | Single synth melody — the simplest possible TuneFrames composition | 120 | 2s |
49
- | `lofi` | Chord progression, melody, kick and snare — complete lo-fi hip-hop beat | 80 | 10s |
50
- | `techno` | 4-on-the-floor kick, noise hihat, detuned bass, pad chords | 130 | 2s |
51
- | `ambient` | Lush reverb pads, crystalline arpeggios — textural ambient | 60 | 2.5s |
52
- | `orchestral` | Strings, brass, woodwinds in a layered orchestral arrangement | 72 | 2.5s |
53
-
54
- Run any example:
55
-
56
- ```bash
57
- npx tuneframes render node_modules/tuneframes/examples/example-lofi.html
8
+ npx tuneframes init my-track
9
+ cd my-track
10
+ tuneframes render track.html --output my-track.mp3
58
11
  ```
59
12
 
60
13
  ---
61
14
 
62
- ## API Reference
63
-
64
- ### Metadata Block
65
-
66
- Add a `<div id="tuneframes">` to the page body to tell TuneFrames how to render:
15
+ ## How it works
67
16
 
68
- ```json
69
- {
70
- "bpm": 120, // Beats per minute (default: 120)
71
- "duration": "4n" // Render duration as Tone.js time (default: "4n")
72
- }
73
- ```
74
-
75
- TuneFrames uses [Tone.js time notation](https://tonejs.github.io/docs/latest/modules/Core.html#Time) — `4n` (quarter note), `2n` (half note), `1n` (whole note), `8n` (eighth note), `16n` (sixteenth note), or any numeric value in seconds.
76
-
77
- ### `main()` Function
78
-
79
- Define an async `main()` function in a `<script>` tag. TuneFrames waits for it to complete, then renders the offline audio buffer.
80
-
81
- ```js
82
- async function main() {
83
- await Tone.start();
17
+ 1. **Write** — Create an HTML file using [Tone.js](https://tonejs.github.io/). Tone.Offline renders the composition to an AudioBuffer with sample-accurate timing.
84
18
 
85
- const synth = new Tone.Synth().toDestination();
86
- // Schedule all your notes, chords, and patterns here
87
- synth.triggerAttackRelease('C4', '4n', 0);
88
- // ...
89
- }
90
- ```
91
-
92
- ### Instruments
93
-
94
- Tone.js provides a complete instrument library:
19
+ 2. **Render** The `tuneframes render` command:
20
+ - Spins up a headless browser
21
+ - Loads your HTML with Tone.js
22
+ - Runs `Tone.Offline()` to get the AudioBuffer
23
+ - Converts to WAV via `audioBufferToWav()`
24
+ - Encodes to MP3 via FFmpeg
95
25
 
96
- - **Synth / MonoSynth / PolySynth** basic tone generation
97
- - **MembraneSynth** — kick drums, toms, bass drums
98
- - **NoiseSynth** — white/pink/brown noise for hi-hats, snares, textures
99
- - **MetalSynth** — metallic percussion (cymbals, shakers)
100
- - **Sampler** — load your own WAV/MP3 samples
101
-
102
- ### Effects
103
-
104
- ```js
105
- const reverb = new Tone.Reverb({ decay: 2.5, wet: 0.3 }).toDestination();
106
- const comp = new Tone.Compressor(-12, 2).toDestination();
107
- const delay = new Tone.FeedbackDelay('8n', 0.4).toDestination();
108
- ```
26
+ 3. **Done** Your audio file, deterministic every time.
109
27
 
110
28
  ---
111
29
 
112
30
  ## CLI
113
31
 
114
32
  ```bash
115
- # Render a composition to MP3
116
- tuneframes render <file.html> [--output <out.mp3>]
33
+ # Install globally
34
+ npm install -g tuneframes
117
35
 
118
- # Render to WAV (no re-encoding)
119
- tuneframes render <file.html> --format wav [--output <out.wav>]
36
+ # Render a composition
37
+ tuneframes render my-track.html --output my-track.mp3
120
38
 
121
- # Preview in browser (dev mode with live reload)
122
- tuneframes preview <file.html>
39
+ # Preview in browser (live reload)
40
+ tuneframes preview my-track.html
123
41
 
124
- # Scaffold a new project
42
+ # Scaffold a new track
125
43
  tuneframes init my-track
126
44
  ```
127
45
 
128
46
  ---
129
47
 
130
- ## TuneFrames vs Hyperframes
48
+ ## Example
131
49
 
132
- TuneFrames is the audio sibling of [Hyperframes](https://github.com/cusidoc/hyperframes) — the same portability model, the same agent-first philosophy, but for music instead of video.
50
+ ```html
51
+ <script src="https://unpkg.com/tone@14.7.77/build/Tone.js"></script>
52
+ <script>
53
+ // Define 4-bar chord progression
54
+ const chords = [
55
+ ['C4', 'E4', 'G4'], // C major
56
+ ['A3', 'C4', 'E4'], // A minor
57
+ ['F3', 'A3', 'C4'], // F major
58
+ ['G3', 'B3', 'D4'], // G major
59
+ ];
60
+
61
+ const synth = new Tone.PolySynth(Tone.Synth).toDestination();
62
+ const seq = new Tone.Sequence((time, note) => {
63
+ synth.triggerAttackRelease(note, '4n', time);
64
+ }, chords.flat()).start(0);
65
+
66
+ Tone.Transport.start();
67
+
68
+ // Render with Tone.Offline
69
+ Tone.Offline(() => {
70
+ new Tone.PolySynth(Tone.Synth).toDestination();
71
+ new Tone.Sequence((time, note) => {
72
+ synth.triggerAttackRelease(note, '4n', time);
73
+ }, chords.flat()).start(0);
74
+ Tone.Transport.start();
75
+ }, 8).then(buffer => {
76
+ const wav = audioBufferToWav(buffer);
77
+ writeFile('track.wav', Buffer.from(wav));
78
+ });
79
+
80
+ // Expose writeFile to the browser
81
+ function audioBufferToWav(buffer) { /* included by tuneframes */ }
82
+ </script>
83
+ ```
133
84
 
134
- | | Hyperframes | TuneFrames |
135
- |---|---|---|
136
- | Output | MP4 video | MP3/WAV audio |
137
- | Framework | Remotion (React) | Tone.js |
138
- | Use case | Video generation, animation | Music composition, sound design |
139
- | Deterministic | Yes | Yes |
85
+ See [`examples/`](examples/) for full compositions — ambient, lo-fi, techno, orchestral, piano, and bass.
140
86
 
141
87
  ---
142
88
 
143
- ## Architecture
89
+ ## Requirements
144
90
 
145
- ```
146
- HTML + Tone.js Chromium (headless, Tone.Offline)
147
- → WAV ( PCM 44.1kHz mono )
148
- → FFmpeg
149
- → MP3 192kbps
150
- ```
91
+ - Node.js 18+
92
+ - FFmpeg (install via `apt install ffmpeg` or `brew install ffmpeg`)
151
93
 
152
- **Tone.Offline** is the key: it renders audio without audio hardware or a browser audio context, producing bit-for-bit identical output every time. Same input HTML = same output MP3, guaranteed.
94
+ ---
95
+
96
+ ## Comparison
97
+
98
+ | | TuneFrames | Suno API | ElevenLabs |
99
+ |---|---|---|---|
100
+ | Open source | ✓ | ✗ | ✗ |
101
+ | Per-render fee | None | Yes | Yes |
102
+ | Agent-native | ✓ | Wrapper | Wrapper |
103
+ | Full audio control | ✓ | Limited | Limited |
104
+ | Deterministic output | ✓ | ✗ | ✗ |
153
105
 
154
106
  ---
155
107
 
156
108
  ## License
157
109
 
158
- Apache 2.0 — use it in any project, commercial or open-source, no strings attached.
159
-
160
- [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
110
+ Apache 2.0
@@ -5,7 +5,7 @@
5
5
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
6
6
  </head>
7
7
  <body>
8
- <div id="tuneframes" style="display:none">{"bpm":60,"duration":"1m"}</div>
8
+ <div id="tuneframes" style="display:none">{"bpm":60,"duration":"16s"}</div>
9
9
  <script>
10
10
  async function main() {
11
11
  await Tone.start();
Binary file
@@ -0,0 +1,48 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TuneFrames — Bass</title>
5
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
6
+ </head>
7
+ <body>
8
+ <div id="tuneframes" style="display:none">{"bpm":120,"duration":"4s"}</div>
9
+ <script>
10
+ async function main() {
11
+ await Tone.start();
12
+ const beat = Tone.Time('4n').toSeconds(); // 0.5s at 120 BPM
13
+
14
+ // Warm, rounded bass tone
15
+ const bass = new Tone.MonoSynth({
16
+ oscillator: { type: 'sawtooth' },
17
+ filter: { Q: 2, type: 'lowpass', rolloff: -12 },
18
+ envelope: { attack: 0.01, decay: 0.2, sustain: 0.4, release: 0.3 },
19
+ filterEnvelope: { attack: 0.01, decay: 0.1, sustain: 0.3, release: 0.2, baseFrequency: 100, octaves: 2 }
20
+ }).toDestination();
21
+ bass.volume.value = -6;
22
+
23
+ // Walking bass line: beats 0-4 (0 to 2s) = Dm, beats 4-7 (2 to 3.5s) = Gm
24
+ // All notes scheduled within duration=4s — notes at time >= 4s are dropped
25
+ const walk = [
26
+ // Bar 1 — Dm: root, 5th, 7th, root / approach, 3rd, 4th, 5th, root
27
+ { note: 'D2', time: 0 },
28
+ { note: 'A2', time: beat },
29
+ { note: 'C3', time: 2 * beat },
30
+ { note: 'D3', time: 3 * beat },
31
+ { note: 'E2', time: 4 * beat },
32
+ { note: 'F2', time: 5 * beat },
33
+ { note: 'G2', time: 6 * beat },
34
+ { note: 'A2', time: 7 * beat },
35
+ // Bar 2 — Gm: root, 5th, 7th, root
36
+ { note: 'G2', time: 8 * beat },
37
+ { note: 'D3', time: 9 * beat },
38
+ { note: 'F3', time: 10 * beat },
39
+ { note: 'G3', time: 11 * beat }
40
+ ];
41
+
42
+ walk.forEach(({ note, time }) => {
43
+ if (time < 4) bass.triggerAttackRelease(note, '8n', time);
44
+ });
45
+ }
46
+ </script>
47
+ </body>
48
+ </html>
Binary file
Binary file
@@ -5,7 +5,7 @@
5
5
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
6
6
  </head>
7
7
  <body>
8
- <div id="tuneframes" style="display:none">{"bpm":80,"duration":"1m"}</div>
8
+ <div id="tuneframes" style="display:none">{"bpm":80,"duration":"10s"}</div>
9
9
  <script>
10
10
  async function main() {
11
11
  await Tone.start();
Binary file
@@ -1,19 +1,21 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
- <title>TuneFrames — Minimal Test</title>
4
+ <title>TuneFrames — Minimal</title>
5
5
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
6
6
  </head>
7
7
  <body>
8
+ <div id="tuneframes" style="display:none">{"bpm":120,"duration":"2s"}</div>
8
9
  <script>
9
- // This must be a named async function for the renderer to call
10
10
  async function main() {
11
- // BPM set in #tuneframes metadata
12
11
  await Tone.start();
13
12
  const synth = new Tone.Synth().toDestination();
14
- // Explicitly schedule at transport time 0
13
+ const beat = Tone.Time('4n').toSeconds();
14
+ // C major arpeggio — three notes, clean and simple
15
15
  synth.triggerAttackRelease('C4', '4n', 0);
16
+ synth.triggerAttackRelease('E4', '4n', beat);
17
+ synth.triggerAttackRelease('G4', '4n', beat * 2);
16
18
  }
17
19
  </script>
18
20
  </body>
19
- </html>
21
+ </html>
Binary file
@@ -5,7 +5,7 @@
5
5
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
6
6
  </head>
7
7
  <body>
8
- <div id="tuneframes" style="display:none">{"bpm":72,"duration":"1m"}</div>
8
+ <div id="tuneframes" style="display:none">{"bpm":72,"duration":"14s"}</div>
9
9
  <script>
10
10
  async function main() {
11
11
  await Tone.start();
Binary file
Binary file
@@ -0,0 +1,53 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>TuneFrames — Piano</title>
5
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
6
+ </head>
7
+ <body>
8
+ <div id="tuneframes" style="display:none">{"bpm":100,"duration":"5s"}</div>
9
+ <script>
10
+ async function main() {
11
+ await Tone.start();
12
+ const beat = Tone.Time('4n').toSeconds();
13
+
14
+ const piano = new Tone.PolySynth(Tone.Synth, {
15
+ oscillator: { type: 'triangle' },
16
+ envelope: { attack: 0.005, decay: 0.3, sustain: 0.3, release: 1.2 }
17
+ }).toDestination();
18
+ piano.volume.value = -8;
19
+
20
+ // Dm - Am - Bb - F chord progression, 2 bars each
21
+ const chords = [
22
+ ['D3', 'F3', 'A3'], // Dm
23
+ ['A2', 'C3', 'E3'], // Am
24
+ ['Bb2', 'D3', 'F3'], // Bb
25
+ ['F2', 'A2', 'C3'] // F
26
+ ];
27
+
28
+ chords.forEach((chord, i) => {
29
+ piano.triggerAttackRelease(chord, '2n', i * 2 * beat);
30
+ });
31
+
32
+ // Melodic line: simple pentatonic over the changes
33
+ const melody = [
34
+ { note: 'D4', time: 0 },
35
+ { note: 'F4', time: beat },
36
+ { note: 'A4', time: beat * 2 },
37
+ { note: 'C4', time: 2 * beat },
38
+ { note: 'E4', time: 2.5 * beat },
39
+ { note: 'D4', time: 3 * beat },
40
+ { note: 'F4', time: 4 * beat },
41
+ { note: 'G4', time: 4.5 * beat },
42
+ { note: 'A4', time: 5 * beat },
43
+ { note: 'Bb4', time: 6 * beat },
44
+ { note: 'F4', time: 7 * beat }
45
+ ];
46
+
47
+ melody.forEach(({ note, time }) => {
48
+ if (time < 5) piano.triggerAttackRelease(note, '8n', time);
49
+ });
50
+ }
51
+ </script>
52
+ </body>
53
+ </html>
Binary file
@@ -5,7 +5,7 @@
5
5
  <script src="https://cdnjs.cloudflare.com/ajax/libs/tone/14.8.49/Tone.js"></script>
6
6
  </head>
7
7
  <body>
8
- <div id="tuneframes" style="display:none">{"bpm":130,"duration":"2n"}</div>
8
+ <div id="tuneframes" style="display:none">{"bpm":130,"duration":"4s"}</div>
9
9
  <script>
10
10
  async function main() {
11
11
  await Tone.start();
Binary file
package/package.json CHANGED
@@ -1,24 +1,37 @@
1
1
  {
2
2
  "name": "tuneframes",
3
- "version": "0.1.0",
4
- "description": "Write HTML with Tone.js. Render music to MP3/WAV with one CLI command. Built for AI agents.",
5
- "repository": "github:cusidoc/tuneframes",
6
- "homepage": "https://github.com/cusidoc/tuneframes#readme",
7
- "author": "Nick Shepherd <nick@moltos.org>",
3
+ "version": "0.1.1",
4
+ "description": "Agent-native music generation. Write Tone.js, render to audio.",
8
5
  "main": "src/cli.js",
9
6
  "bin": {
10
7
  "tuneframes": "src/cli.js"
11
8
  },
12
9
  "scripts": {
13
- "render": "node src/render.js",
14
- "test": "node src/cli.js render examples/example-minimal.html"
10
+ "render": "node src/cli.js render",
11
+ "preview": "node src/cli.js preview"
15
12
  },
16
- "keywords": ["music", "tone.js", "agent", "hyperframes", "ai"],
13
+ "files": [
14
+ "src",
15
+ "examples"
16
+ ],
17
+ "keywords": [
18
+ "tonejs",
19
+ "music",
20
+ "audio",
21
+ "generation",
22
+ "agents",
23
+ "web-audio"
24
+ ],
25
+ "author": "Nathan Shepherd",
17
26
  "license": "Apache-2.0",
18
- "dependencies": {
19
- "playwright": "^1.40.0"
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/Shepherd217/TuneFrames"
20
30
  },
21
31
  "engines": {
22
32
  "node": ">=18"
33
+ },
34
+ "dependencies": {
35
+ "puppeteer": "^22.0.0"
23
36
  }
24
- }
37
+ }
package/src/cli.js CHANGED
@@ -1,11 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
3
  * TuneFrames CLI
4
- *
4
+ *
5
5
  * Commands:
6
6
  * tuneframes render <file.html> [--output track.mp3]
7
7
  * tuneframes init <project-name>
8
8
  * tuneframes preview <file.html>
9
+ * tuneframes validate <file.html>
10
+ * tuneframes add <preset-name>
9
11
  */
10
12
 
11
13
  const { render } = require('./render');
@@ -13,6 +15,8 @@ const fs = require('fs');
13
15
  const path = require('path');
14
16
  const { spawn } = require('child_process');
15
17
 
18
+ const PRESETS = ['drums-lofi', 'reverb-warm', 'chord-progression', 'bass-saw', 'lead-piano'];
19
+
16
20
  async function main() {
17
21
  const [,, cmd, ...args] = process.argv;
18
22
 
@@ -20,12 +24,12 @@ async function main() {
20
24
  case 'render': {
21
25
  const inputFile = args[0];
22
26
  const outputArg = args.find(a => a.startsWith('--output='));
23
- const outputFile = outputArg
24
- ? outputArg.split('=')[1]
27
+ const outputFile = outputArg
28
+ ? outputArg.split('=')[1]
25
29
  : inputFile.replace(/\.html$/, '.mp3');
26
30
 
27
31
  if (!inputFile) {
28
- console.error('Usage: tuneframes render <file.html> [--output=track.mp3]');
32
+ console.error('Usage: tuneframes render <file.html> [--output=track.mp3] [--format wav]');
29
33
  process.exit(1);
30
34
  }
31
35
 
@@ -49,14 +53,14 @@ async function main() {
49
53
 
50
54
  const dir = path.join(process.cwd(), projectName);
51
55
  fs.mkdirSync(dir, { recursive: true });
52
-
56
+
53
57
  const example = fs.readFileSync(
54
58
  path.join(__dirname, '../examples/example-lofi.html'), 'utf8'
55
59
  );
56
60
  fs.writeFileSync(path.join(dir, 'composition.html'), example);
57
- fs.writeFileSync(path.join(dir, 'README.md'),
61
+ fs.writeFileSync(path.join(dir, 'README.md'),
58
62
  `# ${projectName}\n\nRun: tuneframes render composition.html\n`);
59
-
63
+
60
64
  console.log(`Initialized ${projectName}/`);
61
65
  break;
62
66
  }
@@ -67,7 +71,6 @@ async function main() {
67
71
  console.error('Usage: tuneframes preview <file.html>');
68
72
  process.exit(1);
69
73
  }
70
- // Open in default browser (or just tell user where the file is)
71
74
  const url = `file://${path.resolve(inputFile)}`;
72
75
  console.log(`Preview: ${url}`);
73
76
  if (process.platform === 'darwin') {
@@ -78,12 +81,72 @@ async function main() {
78
81
  break;
79
82
  }
80
83
 
84
+ case 'validate': {
85
+ const inputFile = args[0];
86
+ if (!inputFile) {
87
+ console.error('Usage: tuneframes validate <file.html>');
88
+ process.exit(1);
89
+ }
90
+ if (!fs.existsSync(inputFile)) {
91
+ console.error(`File not found: ${inputFile}`);
92
+ process.exit(1);
93
+ }
94
+
95
+ const tmpOut = `/tmp/tuneframes-validate-${Date.now()}.mp3`;
96
+ try {
97
+ await render(inputFile, tmpOut);
98
+ const stats = fs.statSync(tmpOut);
99
+ if (stats.size < 5000) {
100
+ console.error(`FAIL: ${inputFile} rendered to ${stats.size} bytes (< 5000)`);
101
+ process.exit(1);
102
+ }
103
+ console.log(`OK: ${inputFile} — ${stats.size} bytes`);
104
+ } finally {
105
+ if (fs.existsSync(tmpOut)) fs.unlinkSync(tmpOut);
106
+ }
107
+ break;
108
+ }
109
+
110
+ case 'add': {
111
+ const [presetName] = args;
112
+ if (!presetName) {
113
+ console.error(`Usage: tuneframes add <preset>\nAvailable: ${PRESETS.join(', ')}`);
114
+ process.exit(1);
115
+ }
116
+ if (!PRESETS.includes(presetName)) {
117
+ console.error(`Unknown preset: ${presetName}\nAvailable: ${PRESETS.join(', ')}`);
118
+ process.exit(1);
119
+ }
120
+
121
+ const presetPath = path.join(__dirname, `../registry/presets/${presetName}.html`);
122
+ const content = fs.readFileSync(presetPath, 'utf8');
123
+
124
+ // Append to composition.html in current directory
125
+ const compPath = path.join(process.cwd(), 'composition.html');
126
+ if (!fs.existsSync(compPath)) {
127
+ console.error('No composition.html found. Run tuneframes init first.');
128
+ process.exit(1);
129
+ }
130
+
131
+ const existing = fs.readFileSync(compPath, 'utf8');
132
+ const insertMarker = '</script>';
133
+ if (existing.includes(insertMarker)) {
134
+ const newContent = existing.replace(insertMarker, content + '\n' + insertMarker);
135
+ fs.writeFileSync(compPath, newContent);
136
+ } else {
137
+ fs.appendFileSync(compPath, '\n' + content);
138
+ }
139
+
140
+ console.log(`Added ${presetName} to composition.html`);
141
+ break;
142
+ }
143
+
81
144
  default:
82
- console.log(`TuneFrames CLI\n\nCommands:\n tuneframes render <file.html> Render composition to MP3\n tuneframes init <name> Initialize new project\n tuneframes preview <file.html> Open in browser`);
145
+ console.log(`TuneFrames CLI\n\nCommands:\n tuneframes render <file.html> Render composition to MP3\n tuneframes init <name> Initialize new project\n tuneframes preview <file.html> Open in browser\n tuneframes validate <file.html> Validate composition (headless test render)\n tuneframes add <preset> Add preset to composition.html\n\nPresets: ${PRESETS.join(', ')}`);
83
146
  }
84
147
  }
85
148
 
86
149
  main().catch(err => {
87
150
  console.error('Error:', err.message);
88
151
  process.exit(1);
89
- });
152
+ });