scribbletune 5.5.4 → 5.5.5
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/README.md +58 -57
- package/dist/cli.cjs +4 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,6 +107,7 @@ scribbletune --riff C3 phrygian 'x-x[xx]-x-[xx]' 8n --style AABC --outfile riff-
|
|
|
107
107
|
```
|
|
108
108
|
|
|
109
109
|
Riff + motif note:
|
|
110
|
+
|
|
110
111
|
- `--style` creates riff sections by repeating the full pattern per letter.
|
|
111
112
|
- Example: `--style AABC` with pattern `x-x[xx]` creates 4 sections: `A`, `A`, `B`, `C`.
|
|
112
113
|
- Repeated letters reuse the exact same generated section (same rhythm and same notes, including random `R` choices).
|
|
@@ -156,6 +157,7 @@ scribbletune --arp C3 major x 4n 1736 --no-fit-pattern --outfile arp-no-fit.mid
|
|
|
156
157
|
```
|
|
157
158
|
|
|
158
159
|
`--order` behavior:
|
|
160
|
+
|
|
159
161
|
- One-based order is supported (`1234`, `2143`) and is recommended.
|
|
160
162
|
- Zero-based order is also accepted for backward compatibility (`0123`, `1032`).
|
|
161
163
|
|
|
@@ -164,12 +166,12 @@ Run `scribbletune --help` to see the latest CLI usage text.
|
|
|
164
166
|
### Option 2: Node.js
|
|
165
167
|
|
|
166
168
|
```js
|
|
167
|
-
import { scale, clip, midi } from
|
|
169
|
+
import { scale, clip, midi } from "scribbletune";
|
|
168
170
|
|
|
169
|
-
const notes = scale(
|
|
170
|
-
const c = clip({ notes, pattern:
|
|
171
|
+
const notes = scale("C4 major");
|
|
172
|
+
const c = clip({ notes, pattern: "x".repeat(8) });
|
|
171
173
|
|
|
172
|
-
midi(c,
|
|
174
|
+
midi(c, "c-major.mid");
|
|
173
175
|
```
|
|
174
176
|
|
|
175
177
|
Run it with `node` and open the `.mid` file in Ableton Live, GarageBand, Logic, or any DAW.
|
|
@@ -179,14 +181,14 @@ Run it with `node` and open the `.mid` file in Ableton Live, GarageBand, Logic,
|
|
|
179
181
|
Scribbletune's browser entry point adds `Session`, `Channel`, and live `clip()` support on top of [Tone.js](https://tonejs.github.io/).
|
|
180
182
|
|
|
181
183
|
```js
|
|
182
|
-
import { Session } from
|
|
184
|
+
import { Session } from "scribbletune/browser";
|
|
183
185
|
|
|
184
186
|
const session = new Session();
|
|
185
187
|
const channel = session.createChannel({
|
|
186
|
-
instrument:
|
|
188
|
+
instrument: "PolySynth",
|
|
187
189
|
clips: [
|
|
188
|
-
{ pattern:
|
|
189
|
-
{ pattern:
|
|
190
|
+
{ pattern: "x-x-", notes: "C4 E4 G4" },
|
|
191
|
+
{ pattern: "[-xx]", notes: "C4 D#4" },
|
|
190
192
|
],
|
|
191
193
|
});
|
|
192
194
|
|
|
@@ -198,16 +200,20 @@ channel.startClip(0);
|
|
|
198
200
|
### Standalone sample clip (no Session/Channel needed)
|
|
199
201
|
|
|
200
202
|
```js
|
|
201
|
-
import { clip } from
|
|
203
|
+
import { clip } from "scribbletune/browser";
|
|
202
204
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
+
const kickClip = clip({
|
|
206
|
+
sample: "https://scribbletune.com/sounds/kick.wav",
|
|
207
|
+
pattern: "x-x-",
|
|
208
|
+
});
|
|
205
209
|
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
|
|
210
|
+
const btn = document.querySelector("#btn");
|
|
211
|
+
|
|
212
|
+
btn.addEventListener("click", async () => {
|
|
213
|
+
await Tone.start();
|
|
214
|
+
Tone.Transport.start();
|
|
215
|
+
kickClip.start(0);
|
|
209
216
|
});
|
|
210
|
-
kick.start();
|
|
211
217
|
```
|
|
212
218
|
|
|
213
219
|
## Core concepts
|
|
@@ -216,18 +222,18 @@ kick.start();
|
|
|
216
222
|
|
|
217
223
|
Scribbletune uses a simple string notation to describe rhythms:
|
|
218
224
|
|
|
219
|
-
| Char | Meaning
|
|
220
|
-
|
|
221
|
-
| `x`
|
|
222
|
-
| `-`
|
|
223
|
-
| `_`
|
|
224
|
-
| `R`
|
|
225
|
+
| Char | Meaning |
|
|
226
|
+
| ---- | ----------------------------------------------- |
|
|
227
|
+
| `x` | Note on |
|
|
228
|
+
| `-` | Note off (rest) |
|
|
229
|
+
| `_` | Sustain previous note |
|
|
230
|
+
| `R` | Random note (from `randomNotes` pool) |
|
|
225
231
|
| `[]` | Subdivide (e.g. `[xx]` = two notes in one beat) |
|
|
226
232
|
|
|
227
233
|
```js
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
234
|
+
"x---x---x-x-x---"; // basic kick pattern
|
|
235
|
+
"[xx][xx]x-x-"; // hihat with subdivisions
|
|
236
|
+
"x___"; // one long sustained note
|
|
231
237
|
```
|
|
232
238
|
|
|
233
239
|
### Scales and chords
|
|
@@ -235,31 +241,31 @@ Scribbletune uses a simple string notation to describe rhythms:
|
|
|
235
241
|
Powered by [harmonics](https://github.com/scribbletune/harmonics):
|
|
236
242
|
|
|
237
243
|
```js
|
|
238
|
-
import { scale, chord, scales, chords } from
|
|
244
|
+
import { scale, chord, scales, chords } from "scribbletune";
|
|
239
245
|
|
|
240
|
-
scale(
|
|
241
|
-
chord(
|
|
242
|
-
scales();
|
|
243
|
-
chords();
|
|
246
|
+
scale("C4 major"); // ['C4', 'D4', 'E4', 'F4', 'G4', 'A4', 'B4']
|
|
247
|
+
chord("CM"); // ['C4', 'E4', 'G4']
|
|
248
|
+
scales(); // list all available scale names
|
|
249
|
+
chords(); // list all available chord names
|
|
244
250
|
```
|
|
245
251
|
|
|
246
252
|
### Arpeggios
|
|
247
253
|
|
|
248
254
|
```js
|
|
249
|
-
import { arp } from
|
|
255
|
+
import { arp } from "scribbletune";
|
|
250
256
|
|
|
251
|
-
arp({ chords:
|
|
257
|
+
arp({ chords: "CM FM", count: 4, order: "0123" });
|
|
252
258
|
// ['C4', 'E4', 'G4', 'C5', 'F4', 'A4', 'C5', 'F5']
|
|
253
259
|
```
|
|
254
260
|
|
|
255
261
|
### Chord progressions
|
|
256
262
|
|
|
257
263
|
```js
|
|
258
|
-
import { progression, getChordsByProgression } from
|
|
264
|
+
import { progression, getChordsByProgression } from "scribbletune";
|
|
259
265
|
|
|
260
|
-
progression(
|
|
266
|
+
progression("M", 4); // e.g. ['I', 'ii', 'V', 'IV']
|
|
261
267
|
|
|
262
|
-
getChordsByProgression(
|
|
268
|
+
getChordsByProgression("C4 major", "I IV V IV");
|
|
263
269
|
// 'CM_4 FM_4 GM_4 FM_4'
|
|
264
270
|
```
|
|
265
271
|
|
|
@@ -270,22 +276,17 @@ The browser entry point (`scribbletune/browser`) provides everything above plus:
|
|
|
270
276
|
### Session and Channel
|
|
271
277
|
|
|
272
278
|
```js
|
|
273
|
-
import { Session } from
|
|
279
|
+
import { Session } from "scribbletune/browser";
|
|
274
280
|
|
|
275
281
|
const session = new Session();
|
|
276
282
|
const drums = session.createChannel({
|
|
277
|
-
sample:
|
|
278
|
-
clips: [
|
|
279
|
-
{ pattern: 'x---x---' },
|
|
280
|
-
{ pattern: 'x-x-x-x-' },
|
|
281
|
-
],
|
|
283
|
+
sample: "https://scribbletune.com/sounds/kick.wav",
|
|
284
|
+
clips: [{ pattern: "x---x---" }, { pattern: "x-x-x-x-" }],
|
|
282
285
|
});
|
|
283
286
|
|
|
284
287
|
const synth = session.createChannel({
|
|
285
|
-
instrument:
|
|
286
|
-
clips: [
|
|
287
|
-
{ pattern: 'x-x-', notes: 'C4 E4 G4' },
|
|
288
|
-
],
|
|
288
|
+
instrument: "PolySynth",
|
|
289
|
+
clips: [{ pattern: "x-x-", notes: "C4 E4 G4" }],
|
|
289
290
|
});
|
|
290
291
|
|
|
291
292
|
await Tone.start();
|
|
@@ -325,19 +326,19 @@ Channels accept various sound sources:
|
|
|
325
326
|
|
|
326
327
|
## API reference
|
|
327
328
|
|
|
328
|
-
| Export
|
|
329
|
-
|
|
330
|
-
| `clip(params)`
|
|
331
|
-
| `midi(clip, filename?)`
|
|
332
|
-
| `scale(name)`
|
|
333
|
-
| `chord(name)`
|
|
334
|
-
| `scales()`
|
|
335
|
-
| `chords()`
|
|
336
|
-
| `arp(params)`
|
|
337
|
-
| `progression(type, count)`
|
|
338
|
-
| `getChordsByProgression(scale, degrees)` | Convert Roman numeral degrees to chord names
|
|
339
|
-
| `getChordDegrees(mode)`
|
|
340
|
-
| `Session`
|
|
329
|
+
| Export | Description |
|
|
330
|
+
| ---------------------------------------- | --------------------------------------------------------------------------- |
|
|
331
|
+
| `clip(params)` | Create a clip — returns note objects (Node.js) or a Tone.Sequence (browser) |
|
|
332
|
+
| `midi(clip, filename?)` | Export a clip to a MIDI file |
|
|
333
|
+
| `scale(name)` | Get notes of a scale, e.g. `'C4 minor'` |
|
|
334
|
+
| `chord(name)` | Get notes of a chord, e.g. `'CM'` |
|
|
335
|
+
| `scales()` | List all available scale names |
|
|
336
|
+
| `chords()` | List all available chord names |
|
|
337
|
+
| `arp(params)` | Generate arpeggiated note sequences |
|
|
338
|
+
| `progression(type, count)` | Generate a chord progression (`'M'` or `'m'`) |
|
|
339
|
+
| `getChordsByProgression(scale, degrees)` | Convert Roman numeral degrees to chord names |
|
|
340
|
+
| `getChordDegrees(mode)` | Get Roman numeral degrees for a mode |
|
|
341
|
+
| `Session` | _(browser only)_ Manage multiple channels and coordinate playback |
|
|
341
342
|
|
|
342
343
|
## Development
|
|
343
344
|
|
package/dist/cli.cjs
CHANGED
|
@@ -769,13 +769,16 @@ var parseCliArgs = (argv) => {
|
|
|
769
769
|
return options;
|
|
770
770
|
};
|
|
771
771
|
var baseClipParams = (parsed) => {
|
|
772
|
-
|
|
772
|
+
const raw = {
|
|
773
773
|
sizzle: parsed.sizzle,
|
|
774
774
|
sizzleReps: parsed.sizzleReps,
|
|
775
775
|
amp: parsed.amp,
|
|
776
776
|
accent: parsed.accent,
|
|
777
777
|
accentLow: parsed.accentLow
|
|
778
778
|
};
|
|
779
|
+
return Object.fromEntries(
|
|
780
|
+
Object.entries(raw).filter(([, v]) => v !== void 0)
|
|
781
|
+
);
|
|
779
782
|
};
|
|
780
783
|
var makeRiff = (parsed) => {
|
|
781
784
|
const [root, mode, pattern, subdiv] = parsed.positionals;
|